From d90d42364935634477497d3397f8a46ad7a5ccf3 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Mon, 8 Dec 2008 14:36:42 +0000 Subject: * Add sharks. They go into a battle frenzy if they smell blood. * Make harpies actually appear in packs. (Oops...) * Properly pluralise hippogriffs as such. * Regard butcher swap prompt as safe and default to 'n'. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7784 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/delay.cc | 8 ++++---- crawl-ref/source/dungeon.cc | 6 ++++++ crawl-ref/source/enum.h | 1 + crawl-ref/source/libutil.cc | 6 +++--- crawl-ref/source/misc.cc | 8 +------- crawl-ref/source/mon-data.h | 12 ++++++++++++ crawl-ref/source/mon-pick.cc | 4 +++- crawl-ref/source/monplace.cc | 13 ++++++++----- crawl-ref/source/monstuff.cc | 2 ++ crawl-ref/source/view.cc | 33 ++++++++++++++++++++++++++++++++- 10 files changed, 72 insertions(+), 21 deletions(-) diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc index b12f293868..c05b65fc49 100644 --- a/crawl-ref/source/delay.cc +++ b/crawl-ref/source/delay.cc @@ -126,9 +126,9 @@ static int _recite_to_monsters(coord_def where, int pow, int unused) { simple_monster_message(mons, " speeds up in annoyance!"); } - else if (!one_chance_in(3) && - mons->add_ench(mon_enchant(ENCH_BATTLE_FRENZY, 1, KC_YOU, - (16 + random2avg(13, 2)) * 10))) + else if (!one_chance_in(3) + && mons->add_ench(mon_enchant(ENCH_BATTLE_FRENZY, 1, KC_YOU, + (16 + random2avg(13, 2)) * 10))) { simple_monster_message(mons, " goes into a battle-frenzy!"); } @@ -576,7 +576,7 @@ void handle_interrupted_swap(bool swap_if_safe, bool force_unsafe) else if (you.turn_is_over && delay == DELAY_NOT_DELAYED) { // Turn is over, set up a delay to do swapping next turn. - if (prompt && yesno(prompt_str, false) || safe && swap_if_safe) + if (prompt && yesno(prompt_str, true, 'n') || safe && swap_if_safe) { start_delay(DELAY_WEAPON_SWAP, 1, weap); you.attribute[ATTR_WEAPON_SWAP_INTERRUPTED] = 0; diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index 27bd66304e..335aba7330 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -3323,10 +3323,13 @@ static void _place_aquatic_monsters(int level_number, char level_type) if (water_spaces > 49) { + // This can probably be done in a better way with something + // like water_monster_rarity(). for (int i = 0; i < 4; i++) { swimming_things[i] = static_cast(MONS_BIG_FISH + random2(4)); + if (player_in_branch( BRANCH_SWAMP ) && !one_chance_in(3)) swimming_things[i] = MONS_SWAMP_WORM; else if (player_in_branch( BRANCH_SHOALS )) @@ -3340,6 +3343,9 @@ static void _place_aquatic_monsters(int level_number, char level_type) } } + if (level_number >= 9 && one_chance_in(4)) + swimming_things[3] = MONS_SHARK; + if (level_number >= 25 && one_chance_in(5)) swimming_things[0] = MONS_WATER_ELEMENTAL; diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index e35290b58a..3f75a5be06 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -1966,6 +1966,7 @@ enum monster_type // (int) menv[].type MONS_JELLYFISH, MONS_WATER_ELEMENTAL, MONS_SWAMP_WORM, // 435 + MONS_SHARK, // Monsters which move through rock: MONS_ROCK_WORM = 440, diff --git a/crawl-ref/source/libutil.cc b/crawl-ref/source/libutil.cc index 0a985a5d0a..cc7066aedf 100644 --- a/crawl-ref/source/libutil.cc +++ b/crawl-ref/source/libutil.cc @@ -354,12 +354,12 @@ std::string pluralise(const std::string &name, } else if (ends_with(name, "staff")) { - // staff -> staves, but not hippogriff -> hippogrives. + // staff -> staves return name.substr(0, name.length() - 2) + "ves"; } - else if (ends_with(name, "f")) + else if (ends_with(name, "f") && !ends_with(name, "ff")) { - // elf -> elves + // elf -> elves, but not hippogriff -> hippogrives. return name.substr(0, name.length() - 1) + "ves"; } else if (ends_with(name, "mage")) diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 7335e90b26..93fd964699 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -1148,13 +1148,7 @@ static void _maybe_bloodify_square(const coord_def& where, int amount, env.map(where).property |= FPROP_BLOODY; if (smell_alert) - { - // If old or new blood on square, the smell reaches further. - if (testbits(env.map(where).property, FPROP_BLOODY)) - blood_smell(12, where); - else // Still allow a lingering smell. - blood_smell(7, where); - } + blood_smell(12, where); if (spatter) { diff --git a/crawl-ref/source/mon-data.h b/crawl-ref/source/mon-data.h index ac30f09bbc..161fbedf73 100644 --- a/crawl-ref/source/mon-data.h +++ b/crawl-ref/source/mon-data.h @@ -2979,6 +2979,18 @@ static monsterentry mondata[] = { HT_WATER, 10, DEFAULT_ENERGY, MONUSE_NOTHING, SIZE_LITTLE }, +{ + MONS_SHARK, ';', YELLOW, "shark", + // Goes into a battle frenzy when it smells blood. + M_COLD_BLOOD | M_BLOOD_SCENT, + MR_NO_FLAGS, + 0, 12, MONS_SHARK, MONS_SHARK, MH_NATURAL, -3, + { {AT_BITE, AF_PLAIN, 15}, {AT_BITE, AF_PLAIN, 8}, AT_NO_ATK, AT_NO_ATK }, + { 7, 3, 5, 0 }, + 9, 5, MST_NO_SPELLS, CE_NOCORPSE, Z_BIG, S_SILENT, I_ANIMAL, + HT_WATER, 10, DEFAULT_ENERGY, MONUSE_NOTHING, SIZE_LARGE +}, + // lava monsters { MONS_LAVA_WORM, 'w', RED, "lava worm", diff --git a/crawl-ref/source/mon-pick.cc b/crawl-ref/source/mon-pick.cc index 80fc58d920..36f575a49b 100644 --- a/crawl-ref/source/mon-pick.cc +++ b/crawl-ref/source/mon-pick.cc @@ -1708,7 +1708,6 @@ int mons_shoals_level(int mcls) mlev++; break; - case MONS_SIREN: case MONS_YAKTAUR: case MONS_MANTICORE: mlev += 2; @@ -1716,12 +1715,14 @@ int mons_shoals_level(int mcls) case MONS_CENTAUR_WARRIOR: case MONS_CYCLOPS: // will have a sheep band + case MONS_SIREN: case MONS_HARPY: mlev += 3; break; case MONS_STONE_GIANT: case MONS_OKLOB_PLANT: + case MONS_SHARK: mlev += 4; break; @@ -1767,6 +1768,7 @@ int mons_shoals_rare(int mcls) case MONS_STONE_GIANT: case MONS_YAKTAUR_CAPTAIN: + case MONS_SHARK: return 10; case MONS_OKLOB_PLANT: diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc index dc3d6f7af2..3f88e4183d 100644 --- a/crawl-ref/source/monplace.cc +++ b/crawl-ref/source/monplace.cc @@ -587,9 +587,6 @@ int place_monster(mgen_data mg, bool force_pos) #ifdef DEBUG_MON_CREATION mpr("in place_monster()", MSGCH_DIAGNOSTICS); #endif - int band_size = 0; - monster_type band_monsters[BIG_BAND]; // band monster types - int tries = 0; dungeon_char_type stair_type = NUM_DCHAR_TYPES; int id = -1; @@ -606,7 +603,8 @@ int place_monster(mgen_data mg, bool force_pos) return (-1); // (3) Decide on banding (good lord!) - band_size = 1; + int band_size = 1; + monster_type band_monsters[BIG_BAND]; // band monster types band_monsters[0] = mg.cls; if (mg.permit_bands()) @@ -616,6 +614,10 @@ int place_monster(mgen_data mg, bool force_pos) #endif const band_type band = _choose_band(mg.cls, mg.power, band_size); band_size++; + if (band_size > 1) + mprf("Monster type %d: Create a band (band size %d).", + mg.cls, band_size); + for (int i = 1; i < band_size; i++) band_monsters[i] = _band_member( band, mg.power ); } @@ -1210,7 +1212,7 @@ static band_type _choose_band( int mon_type, int power, int &band_size ) mpr("in choose_band()", MSGCH_DIAGNOSTICS); #endif // init - band_size = 0; + band_size = 0; // Single monster, no band. band_type band = BAND_NO_BAND; switch (mon_type) @@ -1571,6 +1573,7 @@ static monster_type _band_member(band_type band, int power) case BAND_HARPIES: mon_type = MONS_HARPY; + break; case BAND_UGLY_THINGS: mon_type = ((power > 21 && one_chance_in(4)) ? diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index e884628f9a..4c498f0def 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -374,8 +374,10 @@ static void _place_monster_corpse(const monsters *monster, bool silent, if (you.can_see(monster)) simple_monster_message(monster, " turns back into a corpse!"); else + { mprf("%s appears out of nowhere!", mitm[o].name(DESC_CAP_A).c_str()); + } } const bool poison = (mons_corpse_effect(corpse_class) == CE_POISONOUS && player_res_poison() <= 0); diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 475987f265..99b9f8cdbb 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -39,6 +39,7 @@ #include "macro.h" #include "message.h" #include "misc.h" +#include "monplace.h" #include "monstuff.h" #include "mon-util.h" #include "newgame.h" @@ -1704,7 +1705,8 @@ void blood_smell( int strength, const coord_def& where ) { // Let sleeping hounds lie. if (mons_is_sleeping(monster) - && mons_species(monster->type) != MONS_VAMPIRE) + && mons_species(monster->type) != MONS_VAMPIRE + && monster->type != MONS_SHARK) { // 33% chance of sleeping on // 33% of being disturbed (start BEH_WANDER) @@ -1729,6 +1731,35 @@ void blood_smell( int strength, const coord_def& where ) monster->pos().x, monster->pos().y); #endif behaviour_event( monster, ME_ALERT, MHITNOT, where ); + + if (monster->type == MONS_SHARK) + { + // Sharks go into a battle frenzy if they smell blood. + monster_pathfind mp; + if (mp.init_pathfind(monster, where)) + { + mon_enchant ench = monster->get_ench(ENCH_BATTLE_FRENZY); + const int dist = 15 - (monster->pos() - where).rdist(); + const int dur = random_range(dist, dist*2) + * speed_to_duration(monster->speed); + + if (ench.ench != ENCH_NONE) + { + int level = ench.degree; + if (level < 4 && one_chance_in(2*level)) + ench.degree++; + ench.duration = std::max(ench.duration, dur); + monster->update_ench(ench); + } + else + { + monster->add_ench(mon_enchant(ENCH_BATTLE_FRENZY, 1, + KC_OTHER, dur)); + simple_monster_message(monster, " is consumed with " + "blood-lust!"); + } + } + } } } } -- cgit v1.2.3-54-g00ecf