From f41f4cb56e95d2e36fa21b9504282d9e34eddc75 Mon Sep 17 00:00:00 2001 From: zelgadis Date: Sat, 13 Dec 2008 10:06:40 +0000 Subject: First draft of the spell noisyness system: spells cast by the player and by wizard/priest monsters now make noise, with the loudness depending upon level and spell disciplines: conjuration spells have a loudness equal to their level, spells containing only air and/or poison equal to 50% of their level (rounded up), and everything else to 75% of the level (rounded up). This undoudedtly needs rebalancing, and a better level+disciplines -> loudness formula. Also, each spell can have it's loudness tweaked from the default via the noise_mod field of the spell_desc field in spl-data.h, for those spells whose desired loudness don't quite fit into whatever formula is used. The messages used to announce a spell have been moved out to source/dat/database/monspell.txt, which uses the same format and conventions as monspeak.txt. So far this has just been used to make invisible wizard/priest monsters give a message to the player if the player can hear them cast, and also to make curse skulls and Murray not "gesture wildly". However, it could be used to give a greater variety of spell announcement messages based upon the spell used or the monster's type/species/genus, and/or to give multi-part messages. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7820 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/dat/database/monspell.txt | 103 ++++++++++++++ crawl-ref/source/database.cc | 1 + crawl-ref/source/mon-data.h | 2 +- crawl-ref/source/monspeak.cc | 17 ++- crawl-ref/source/monspeak.h | 3 + crawl-ref/source/monstuff.cc | 188 ++++--------------------- crawl-ref/source/mstuff2.cc | 144 +++++++++++++++++++- crawl-ref/source/mstuff2.h | 4 +- crawl-ref/source/spl-cast.cc | 12 +- crawl-ref/source/spl-data.h | 211 ++++++++++++++++++++++++++++- crawl-ref/source/spl-util.cc | 44 ++++++ crawl-ref/source/spl-util.h | 26 +--- 12 files changed, 555 insertions(+), 200 deletions(-) create mode 100644 crawl-ref/source/dat/database/monspell.txt (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/dat/database/monspell.txt b/crawl-ref/source/dat/database/monspell.txt new file mode 100644 index 0000000000..d887bcf4ae --- /dev/null +++ b/crawl-ref/source/dat/database/monspell.txt @@ -0,0 +1,103 @@ +##################################################### +# Individual spells. +##################################################### +%%%% +Poison Splash cast + +@The_monster@ spits poison. +%%%% +Poison Splash cast unseen + +You hear a spitting sound. +%%%% +Symbol of Torment cast + +@The_monster@ calls on the powers of Hell! +%%%% +Symbol of Torment cast unseen + +@The_something@ calls on the powers of Hell! +##################################################### +# Priest and wizard casting messages. +##################################################### +%%%% +priest cast + +@The_monster@ prays. + +@The_monster@ mumbles some strange prayers. + +@The_monster@ utters an invocation. +%%%% +priest cast unseen + +You hear some strange, mumbled prayers. +%%%% +wizard cast + +@The_monster@ gestures wildly. + +@The_monster@ mumbles some strange words. + +@The_monster@ casts a spell. +%%%% +wizard cast unseen + +You hear some strange, mumbled words. +######################################################################## +# Monster genus and species messages. +######################################################################## +%%%% +demon cast + +@The_monster@ gestures. +%%%% +dragon cast + +@The_monster@ breaths. +%%%% +dragon cast unseen + +You hear a roar. +%%%% +curse skull cast + +@The_monster@ rattles @possessive@ jaw. + +@The_monster@ casts a spell. +%%%% +curse skull cast unseen + +You hear the clattering of teeth. +%%%% +giant eyeball cast + +@The_monster@ gazes. +######################################################################## +# Individual monsters +######################################################################## +%%%% +Geryon cast + +@The_monster@ winds a great silver horn. +%%%% +Geryon cast unseen + +You hear a weird and mournful sound. +%%%% +giant orange brain cast + +@The_monster@ pulsates. +%%%% +orb of fire cast + +@The_monster@ glows yellow. + +@The_monster@ glows bright magenta. + +@The_monster@ glows deep purple. + +@The_monster@ glows red. + +@The_monster@ emits a lurid red light. +%%%% diff --git a/crawl-ref/source/database.cc b/crawl-ref/source/database.cc index 68637eb56e..80b2369699 100644 --- a/crawl-ref/source/database.cc +++ b/crawl-ref/source/database.cc @@ -80,6 +80,7 @@ static TextDB AllDBs[] = TextDB( "db/speak", "database/monspeak.txt", // monster speech + "database/monspell.txt", // monster spellcasting speech "database/wpnnoise.txt", // noisy weapon speech "database/insult.txt", // imp/demon taunts "database/godspeak.txt", // god speech diff --git a/crawl-ref/source/mon-data.h b/crawl-ref/source/mon-data.h index a3116488fa..a2b768e15c 100644 --- a/crawl-ref/source/mon-data.h +++ b/crawl-ref/source/mon-data.h @@ -2087,7 +2087,7 @@ static monsterentry mondata[] = { MONS_SHINING_EYE, 'G', LIGHTMAGENTA, "shining eye", M_NO_SKELETON | M_LEVITATE | M_SPELLCASTER | M_SEE_INVIS | M_GLOWS, MR_RES_ASPHYX, - 0, 14, MONS_SHINING_EYE, MONS_SHINING_EYE, MH_NATURAL, MAG_IMMUNE, + 0, 14, MONS_GIANT_EYEBALL, MONS_SHINING_EYE, MH_NATURAL, MAG_IMMUNE, { AT_NO_ATK, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK }, { 10, 3, 5, 0 }, 3, 1, MST_SHINING_EYE, CE_MUTAGEN_RANDOM, Z_NOZOMBIE, S_SILENT, I_PLANT, diff --git a/crawl-ref/source/monspeak.cc b/crawl-ref/source/monspeak.cc index 46579c91d4..059ad562cc 100644 --- a/crawl-ref/source/monspeak.cc +++ b/crawl-ref/source/monspeak.cc @@ -482,10 +482,17 @@ bool mons_speaks(const monsters *monster) return (false); } + mons_speaks_msg(monster, msg, MSGCH_TALK, silence); + return (true); +} // end mons_speaks = end of routine + +void mons_speaks_msg(const monsters *monster, const std::string &msg, + const msg_channel_type def_chan, const bool silence) +{ // We have a speech string, now parse and act on it. - msg = do_mon_str_replacements(msg, monster); + std::string _msg = do_mon_str_replacements(msg, monster); - std::vector lines = split_string("\n", msg); + std::vector lines = split_string("\n", _msg); for (int i = 0, size = lines.size(); i < size; i++) { @@ -498,7 +505,7 @@ bool mons_speaks(const monsters *monster) // function as spells and danger warning... everything else // just goes into the talk channel -- bwr // [jpeg] Added MSGCH_TALK_VISUAL for silent "chatter" - msg_channel_type msg_type = MSGCH_TALK; + msg_channel_type msg_type = def_chan; std::string param = ""; std::string::size_type pos = line.find(":"); @@ -556,6 +563,4 @@ bool mons_speaks(const monsters *monster) mpr(line.c_str(), msg_type); } - - return (true); -} // end mons_speaks = end of routine +} diff --git a/crawl-ref/source/monspeak.h b/crawl-ref/source/monspeak.h index a4658652e9..50473fd629 100644 --- a/crawl-ref/source/monspeak.h +++ b/crawl-ref/source/monspeak.h @@ -11,5 +11,8 @@ #include "externs.h" bool mons_speaks(const monsters *monster); +void mons_speaks_msg(const monsters *monster, const std::string &msg, + const msg_channel_type def_chan = MSGCH_TALK, + const bool silence = false); #endif diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index fe0d242e43..418aadb7b1 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -4941,7 +4941,6 @@ static bool _handle_special_ability(monsters *monster, bolt & beem) if (mons_should_fire(beem)) { _make_mons_stop_fleeing(monster); - simple_monster_message( monster, " makes a gesture!", spl ); mons_cast(monster, beem, spell_cast); used = true; @@ -5602,19 +5601,6 @@ static bool _is_emergency_spell(const monster_spells &msp, int spell) return (msp[5] == spell); } -static const char *_orb_of_fire_glow() -{ - static const char *orb_glows[] = - { - " glows yellow.", - " glows bright magenta.", - " glows deep purple.", // Smoke on the Water - " glows red.", - " emits a lurid red light.", - }; - return RANDOM_ELEMENT(orb_glows); -} - static bool _mons_announce_cast(monsters *monster, bool nearby, spell_type spell_cast, spell_type draco_breath) @@ -5624,154 +5610,25 @@ static bool _mons_announce_cast(monsters *monster, bool nearby, if (nearby) { - // Handle monsters within range of player. - if (monster->type == MONS_GERYON) - { - if (silenced(monster->pos())) - return (false); - - simple_monster_message( monster, " winds a great silver horn.", - spl ); - } - else if (mons_is_demon( monster->type )) - { - simple_monster_message( monster, " gestures.", spl ); - } - else + if (spell_cast == draco_breath) { - switch (monster->type) + if (simple_monster_message(monster, " breathes.", spl)) + return (true); + else { - default: - if (spell_cast == draco_breath) - { - if (!simple_monster_message(monster, " breathes.", spl)) - { - if (!silenced(monster->pos()) - && !silenced(you.pos())) - { - mpr("You hear a roar.", MSGCH_SOUND); - } - } - break; - } - - if (silenced(monster->pos())) - return (false); - - if (mons_class_flag(monster->type, M_PRIEST)) - { - switch (random2(3)) - { - case 0: - simple_monster_message(monster, " prays.", spl); - break; - case 1: - simple_monster_message(monster, - " mumbles some strange prayers.", - spl); - break; - case 2: - default: - simple_monster_message(monster, - " utters an invocation.", spl); - break; - } - } - else // not a priest + if (!silenced(monster->pos()) + && !silenced(you.pos())) { - switch (random2(3)) - { - case 0: - // XXX: could be better, chosen to match the - // ones in monspeak.cc... has the problem - // that it doesn't suggest a vocal component. -- bwr - if (player_monster_visible(monster)) - { - simple_monster_message(monster, - " gestures wildly.", spl ); - } - break; - case 1: - simple_monster_message(monster, - " mumbles some strange words.", - spl); - break; - case 2: - default: - simple_monster_message(monster, " casts a spell.", spl); - break; - } - } - break; - - case MONS_BALL_LIGHTNING: - monster->hit_points = -1; - break; - - case MONS_STEAM_DRAGON: - case MONS_MOTTLED_DRAGON: - case MONS_STORM_DRAGON: - case MONS_GOLDEN_DRAGON: - case MONS_SHADOW_DRAGON: - case MONS_SWAMP_DRAGON: - case MONS_SWAMP_DRAKE: - case MONS_DEATH_DRAKE: - case MONS_HELL_HOG: - case MONS_SERPENT_OF_HELL: - case MONS_QUICKSILVER_DRAGON: - case MONS_IRON_DRAGON: - if (!simple_monster_message(monster, " breathes.", spl)) - { - if (!silenced(monster->pos()) - && !silenced(you.pos())) - { - mpr("You hear a roar.", MSGCH_SOUND); - } + mpr("You hear a roar.", MSGCH_SOUND); + return (true); } - break; - - case MONS_VAPOUR: - monster->add_ench(ENCH_SUBMERGED); - break; - - case MONS_BRAIN_WORM: - case MONS_ELECTRIC_GOLEM: - case MONS_ICE_STATUE: - // These don't show any signs that they're casting a spell. - break; - - case MONS_GREAT_ORB_OF_EYES: - case MONS_SHINING_EYE: - case MONS_EYE_OF_DEVASTATION: - simple_monster_message(monster, " gazes.", spl); - break; - - case MONS_GIANT_ORANGE_BRAIN: - simple_monster_message(monster, " pulsates.", spl); - break; - - case MONS_NAGA: - case MONS_NAGA_WARRIOR: - simple_monster_message(monster, " spits poison.", spl); - break; - - case MONS_ORB_OF_FIRE: - simple_monster_message(monster, _orb_of_fire_glow(), spl); - break; } } - } - else - { - // Handle far-away monsters. - if (monster->type == MONS_GERYON - && !silenced(you.pos())) - { - mpr("You hear a weird and mournful sound.", MSGCH_SOUND); - } + else if (monster->type == -1) + monster->hit_points = -1; } - return (true); + return (false); } //--------------------------------------------------------------- @@ -5800,6 +5657,16 @@ static bool _handle_spell(monsters *monster, bolt &beem) return (false); } + // Geryon can't summon beasts if he's silenced since he uses a horn, + // and we have to check for him explicitly since he's neither a priest + // nor a wizard. + if (silenced(monster->pos()) + && (monster->type == MONS_GERYON + || mons_class_flag(monster->type, M_PRIEST | M_ACTUAL_SPELLS))) + { + return (false); + } + // Shapeshifters don't get spells. if (mons_is_shapeshifter(monster) && (mons_class_flag(monster->type, M_ACTUAL_SPELLS) @@ -6074,11 +5941,9 @@ static bool _handle_spell(monsters *monster, bolt &beem) return (false); } - if (!_mons_announce_cast(monster, monsterNearby, - spell_cast, draco_breath)) - { - return (false); - } + const bool did_noise = + _mons_announce_cast(monster, monsterNearby, + spell_cast, draco_breath); // FINALLY! determine primary spell effects {dlb}: if (spell_cast == SPELL_BLINK) @@ -6086,6 +5951,9 @@ static bool _handle_spell(monsters *monster, bolt &beem) // Why only cast blink if nearby? {dlb} if (monsterNearby) { + if (!did_noise) + mons_cast_noise(monster, beem, spell_cast); + simple_monster_message(monster, " blinks!"); monster_blink(monster); @@ -6099,7 +5967,7 @@ static bool _handle_spell(monsters *monster, bolt &beem) if (spell_needs_foe(spell_cast)) _make_mons_stop_fleeing(monster); - mons_cast(monster, beem, spell_cast); + mons_cast(monster, beem, spell_cast, !did_noise); mmov.reset(); monster->lose_energy(EUT_SPELL); } diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc index 0c6a7a269e..1e9deb03e7 100644 --- a/crawl-ref/source/mstuff2.cc +++ b/crawl-ref/source/mstuff2.cc @@ -17,6 +17,7 @@ #include "externs.h" #include "beam.h" +#include "database.h" #include "debug.h" #include "effects.h" #include "item_use.h" @@ -26,6 +27,7 @@ #include "message.h" #include "misc.h" #include "monplace.h" +#include "monspeak.h" #include "monstuff.h" #include "mon-util.h" #include "player.h" @@ -117,7 +119,8 @@ static bool _los_free_spell(spell_type spell_cast) || spell_cast == SPELL_AIRSTRIKE; } -void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast) +void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast, + bool do_noise) { // Always do setup. It might be done already, but it doesn't // hurt to do it again (cheap). @@ -140,14 +143,23 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast) if (monster->foe == MHITYOU || monster->foe == MHITNOT) { if (monsterNearby) + { + if (do_noise) + mons_cast_noise(monster, pbolt, spell_cast); direct_effect(monster, spell_cast, pbolt, &you); + } return; } + if (do_noise) + mons_cast_noise(monster, pbolt, spell_cast); direct_effect(monster, spell_cast, pbolt, monster->get_foe()); return; } + if (do_noise) + mons_cast_noise(monster, pbolt, spell_cast); + switch (spell_cast) { default: @@ -360,8 +372,6 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast) if (!monsterNearby || mons_friendly(monster)) return; - simple_monster_message(monster, " calls on the powers of Hell!"); - torment(monster_index(monster), monster->pos()); return; @@ -491,6 +501,134 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast) fire_beam(pbolt); } +void mons_cast_noise(monsters *monster, bolt &pbolt, spell_type spell_cast) +{ + const bool unseen = !you.can_see(monster); + const bool silent = silenced(monster->pos()); + + if (unseen && silent) + return; + + const bool priest = mons_class_flag(monster->type, M_PRIEST); + const bool wizard = mons_class_flag(monster->type, M_ACTUAL_SPELLS); + const bool innate = !(priest || wizard); + + int noise; + if(silent || innate) + noise = 0; + else + noise = spell_noise(spell_cast); + + const std::string cast_str = " cast"; + std::string suffix; + if (silent) + suffix = " silent"; + else if (unseen) + suffix = " unseen"; + + std::string key; + + // First try the individual spell. + key = spell_title(spell_cast) + cast_str; + std::string msg = getSpeakString(key + suffix); + + if (msg.empty() && silent) + msg = getSpeakString(key); + + // Second, try the individual monster. + if (msg.empty()) + { + key = mons_type_name(monster->type, DESC_PLAIN); + key += cast_str; + msg = getSpeakString(key + suffix); + + if (msg.empty() && silent) + msg = getSpeakString(key); + } + + // Third, try generic priest or wizard messages. + if (msg.empty() && !innate) + { + if (priest) + key = "priest"; + else + key = "wizard"; + + key += cast_str; + msg = getSpeakString(key + suffix); + + if (msg.empty() && silent) + msg = getSpeakString(key); + } + + // Fourth, try the monster's species. + if (msg.empty()) + { + key = mons_type_name(mons_species(monster->type), DESC_PLAIN); + key += cast_str; + msg = getSpeakString(key + suffix); + + if (msg.empty() && silent) + msg = getSpeakString(key); + } + + // Fifth, try the monster's genus. + if (msg.empty()) + { + key = mons_type_name(mons_genus(monster->type), DESC_PLAIN); + key += cast_str; + msg = getSpeakString(key + suffix); + + if (msg.empty() && silent) + msg = getSpeakString(key); + } + + // Lastly, maybe it's a demon. + if (msg.empty() && mons_is_demon(monster->type)) + { + key = "demon"; + key += cast_str; + msg = getSpeakString(key + suffix); + + if (msg.empty() && silent) + msg = getSpeakString(key); + } + + if (msg.empty()) + { + if (silent) + return; + + noisy(noise, monster->pos()); + return; + } + + const msg_channel_type chan = + (unseen ? MSGCH_SOUND : + mons_friendly(monster) ? MSGCH_FRIEND_SPELL : + MSGCH_MONSTER_SPELL); + + if (silent) + { + mons_speaks_msg(monster, msg, chan, true); + return; + } + + if (msg.find(" roar") != std::string::npos) + noise = get_shout_noise_level(S_ROAR); + else if (msg.find(" breathes") != std::string::npos) + { + shout_type type = mons_shouts(monster->type); + if(type == S_SILENT) + type = S_ROAR; + noise = get_shout_noise_level(type); + } + + // noisy() returns true if the player heard the noise. + if (noisy(noise, monster->pos()) || !unseen) + mons_speaks_msg(monster, msg, chan); +} + // Set up bolt structure for monster spell casting. void setup_mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast) diff --git a/crawl-ref/source/mstuff2.h b/crawl-ref/source/mstuff2.h index d1ec4febdd..9eb26839f4 100644 --- a/crawl-ref/source/mstuff2.h +++ b/crawl-ref/source/mstuff2.h @@ -18,7 +18,9 @@ struct bolt; bolt mons_spells(monsters *mons, spell_type spell_cast, int power); void setup_dragon(monsters *monster, bolt &pbolt); -void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast); +void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast, + bool do_noise = true); +void mons_cast_noise(monsters *monster, bolt &pbolt, spell_type spell_cast); void setup_mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast); bool mons_throw(monsters *monster, bolt &pbolt, int hand_used); bool mons_thrown_object_destroyed( item_def *item, const coord_def& where, diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 0a51a49333..738810e43d 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -1067,6 +1067,14 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail) if (powc == 0) powc = calc_spell_power( spell, true ); + const god_type god = + (crawl_state.is_god_acting()) ? crawl_state.which_god_acting() + : GOD_NO_GOD; + + // Make some noise if it's actually the player casting. + if (god == GOD_NO_GOD) + noisy( spell_noise(spell), you.pos() ); + if (allow_fail) { int spfl = random2avg(100, 3); @@ -1136,10 +1144,6 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail) mprf(MSGCH_DIAGNOSTICS, "Spell #%d, power=%d", spell, powc); #endif - const god_type god = - (crawl_state.is_god_acting()) ? crawl_state.which_god_acting() - : GOD_NO_GOD; - switch (spell) { // spells using burn_freeze() diff --git a/crawl-ref/source/spl-data.h b/crawl-ref/source/spl-data.h index c7cfdeebb2..ac91b1eccc 100644 --- a/crawl-ref/source/spl-data.h +++ b/crawl-ref/source/spl-data.h @@ -136,6 +136,7 @@ 6, 0, -1, -1, + 0, NULL, false, true @@ -148,6 +149,7 @@ 5, 0, -1, -1, + 0, NULL, false, true @@ -160,6 +162,7 @@ 5, 200, LOS_RADIUS, LOS_RADIUS, + 0, NULL, false, false @@ -172,6 +175,7 @@ 1, 0, LOS_RADIUS, LOS_RADIUS, + 0, NULL, false, true @@ -184,6 +188,7 @@ 5, 0, -1, -1, + 0, NULL, false, true @@ -196,6 +201,7 @@ 1, 25, LOS_RADIUS, LOS_RADIUS, + 0, NULL, true, false @@ -208,6 +214,7 @@ 6, 200, 6, 6, + 0, NULL, true, false @@ -220,6 +227,7 @@ 4, 0, -1, -1, + 0, NULL, false, false @@ -232,6 +240,7 @@ 1, 1000, LOS_RADIUS, LOS_RADIUS, + 0, NULL, false, false @@ -244,6 +253,7 @@ 1, 25, LOS_RADIUS, LOS_RADIUS, + 0, NULL, true, false @@ -256,6 +266,7 @@ 3, 100, LOS_RADIUS, LOS_RADIUS, + 0, NULL, true, false @@ -268,6 +279,7 @@ 7, 0, -1, -1, + 0, NULL, false, true @@ -280,6 +292,7 @@ 1, 25, 5, 5, + 0, NULL, true, false @@ -292,6 +305,7 @@ 3, 100, 4, 4, + 0, NULL, false, false @@ -304,6 +318,7 @@ 4, 200, -1, -1, + 0, NULL, false, true @@ -316,6 +331,7 @@ 6, 200, 6, 6, + 0, NULL, true, false @@ -328,6 +344,7 @@ 6, 200, 7, 7, + 0, NULL, true, false @@ -340,6 +357,7 @@ 5, 200, 5, 12, + 0, NULL, true, false @@ -352,6 +370,7 @@ 5, 200, 5, 5, + 0, NULL, true, false @@ -364,6 +383,7 @@ 5, 200, LOS_RADIUS, LOS_RADIUS, + 0, NULL, true, false @@ -376,6 +396,7 @@ 3, 200, LOS_RADIUS, LOS_RADIUS, + 0, NULL, true, false @@ -390,6 +411,7 @@ // not that much better than Invisibility. -- bwr 200, LOS_RADIUS, LOS_RADIUS, + 0, NULL, false, true @@ -402,6 +424,7 @@ 4, 200, LOS_RADIUS, LOS_RADIUS, + 0, NULL, true, false @@ -414,6 +437,7 @@ 4, 200, LOS_RADIUS, LOS_RADIUS, + 0, NULL, true, false @@ -426,6 +450,7 @@ 3, 200, LOS_RADIUS, LOS_RADIUS, + 0, NULL, true, false @@ -438,6 +463,7 @@ 6, 200, LOS_RADIUS, LOS_RADIUS, + 0, NULL, false, true @@ -450,6 +476,7 @@ 2, 50, 7, 7, + 0, NULL, true, false @@ -462,6 +489,7 @@ 2, 50, 8, 8, + 0, NULL, true, false @@ -474,6 +502,7 @@ 7, 0, -1, -1, + 0, NULL, false, true @@ -486,6 +515,7 @@ 7, 200, 6, 6, + 0, "Where do you want to put it?", true, false @@ -498,6 +528,7 @@ 3, 200, 8, 8, + 0, NULL, true, false @@ -510,6 +541,7 @@ 8, 200, -1, -1, + 0, NULL, false, false @@ -522,6 +554,7 @@ 2, 0, -1, -1, + 0, NULL, false, true @@ -534,6 +567,7 @@ 2, 0, -1, -1, + 0, NULL, false, true @@ -546,6 +580,7 @@ 2, 0, -1, -1, + 0, NULL, false, true @@ -558,6 +593,7 @@ 5, 200, 6, 6, + 0, NULL, true, false @@ -570,6 +606,7 @@ 4, 0, -1, -1, + 0, NULL, true, false @@ -582,6 +619,7 @@ 4, 200, LOS_RADIUS, LOS_RADIUS, + 0, NULL, true, false @@ -594,6 +632,7 @@ 2, 0, LOS_RADIUS, LOS_RADIUS, + 0, NULL, false, true @@ -606,6 +645,7 @@ 6, 0, LOS_RADIUS, LOS_RADIUS, + 0, NULL, false, true @@ -618,6 +658,7 @@ 3, 200, -1, -1, + 0, NULL, false, true @@ -630,6 +671,7 @@ 5, 0, -1, -1, + 0, NULL, false, true @@ -642,6 +684,7 @@ 8, 200, -1, -1, + 0, NULL, false, false @@ -654,6 +697,7 @@ 4, 0, -1, -1, + 0, NULL, false, true @@ -666,6 +710,7 @@ 6, 200, -1, -1, + 0, NULL, false, false @@ -678,6 +723,7 @@ 4, 200, LOS_RADIUS, LOS_RADIUS, + 4, // SPTYP_NONE spells have no default noise level "Smite whom?", false, false @@ -690,6 +736,7 @@ 3, 0, -1, -1, + 0, NULL, false, false @@ -702,6 +749,7 @@ 7, 0, -1, -1, + 0, NULL, false, false @@ -714,6 +762,7 @@ 3, 0, -1, -1, + 0, NULL, false, true @@ -726,6 +775,7 @@ 1, 80, -1, -1, + 0, NULL, false, false @@ -738,6 +788,7 @@ 3, 200, -1, -1, + 0, NULL, false, false @@ -750,6 +801,7 @@ 4, 200, -1, -1, + 0, NULL, false, false @@ -762,6 +814,7 @@ 2, 150, -1, -1, + 0, NULL, false, true @@ -774,6 +827,7 @@ 6, 200, 6, 6, + 0, NULL, true, false @@ -786,6 +840,7 @@ 8, 200, 4, 4, + 0, NULL, true, false @@ -798,6 +853,7 @@ 3, 1000, 7, 7, + 0, NULL, true, false @@ -810,6 +866,7 @@ 6, 200, 6, 6, + 0, "Where do you want to put it?", true, false @@ -822,6 +879,7 @@ 9, 200, 6, 6, + 0, "Where?", true, false @@ -834,6 +892,7 @@ 2, 50, -1, -1, + 0, NULL, false, true @@ -846,6 +905,7 @@ 2, 0, -1, -1, + 0, NULL, false, true @@ -860,6 +920,7 @@ 4, 100, 5, 5, + 0, NULL, true, false @@ -872,6 +933,7 @@ 6, 200, -1, -1, + 0, NULL, false, false @@ -884,6 +946,7 @@ 8, 200, -1, -1, + 0, NULL, false, false @@ -896,6 +959,7 @@ 4, 200, LOS_RADIUS, LOS_RADIUS, + 0, NULL, true, false @@ -908,6 +972,7 @@ 4, 45, -1, -1, + 0, NULL, false, true @@ -920,6 +985,7 @@ 3, 100, LOS_RADIUS, LOS_RADIUS, + 0, NULL, true, true @@ -932,6 +998,7 @@ 4, 0, -1, -1, + 0, NULL, false, true @@ -944,6 +1011,7 @@ 1, 25, 6, 6, + 0, NULL, true, false @@ -956,6 +1024,7 @@ 5, 200, -1, -1, + 0, NULL, false, true @@ -968,6 +1037,7 @@ 6, 200, -1, -1, + 0, NULL, true }, @@ -979,6 +1049,7 @@ 1, 0, -1, -1, + 0, NULL, false, true @@ -991,6 +1062,7 @@ 3, 200, 1, 1, + 0, NULL, false, false @@ -1003,6 +1075,7 @@ 7, 200, -1, -1, + 0, NULL, false, false @@ -1015,6 +1088,7 @@ 2, 50, -1, -1, + 0, NULL, false, true @@ -1027,6 +1101,7 @@ 5, 200, -1, -1, + 0, NULL, false, true @@ -1039,6 +1114,7 @@ 1, 25, 1, 1, + 0, NULL, false, false @@ -1051,6 +1127,7 @@ 1, 25, 1, 1, + 0, NULL, false, false @@ -1063,6 +1140,7 @@ 4, 200, -1, -1, + 0, NULL, false, false @@ -1075,6 +1153,7 @@ 5, 200, -1, -1, + 0, NULL, true, false @@ -1087,6 +1166,7 @@ 4, 100, 5, 5, + 0, NULL, true, false @@ -1099,6 +1179,7 @@ 5, 200, -1, -1, + 0, NULL, false, false @@ -1111,6 +1192,7 @@ 3, 200, -1, -1, + 0, NULL, false, false @@ -1123,6 +1205,7 @@ 3, 200, -1, -1, + 0, NULL, false, false @@ -1135,6 +1218,7 @@ 2, 200, -1, -1, + 0, NULL, false, false @@ -1147,6 +1231,7 @@ 3, 0, -1, -1, + 0, NULL, false, false @@ -1159,6 +1244,7 @@ 4, 100, LOS_RADIUS, LOS_RADIUS, + 0, NULL, true, false @@ -1171,6 +1257,7 @@ 7, 200, -1, -1, + 0, NULL, false, false @@ -1183,6 +1270,7 @@ 4, 200, -1, -1, + 0, NULL, false, false @@ -1195,6 +1283,7 @@ 6, // why is this the only holy spell with a secondary? {dlb} 200, 8, 8, + 0, NULL, true, false @@ -1208,6 +1297,7 @@ 8, 200, 6, 6, + 0, NULL, true, false @@ -1220,6 +1310,7 @@ 7, 200, -1, -1, + 0, NULL, false, false @@ -1232,6 +1323,7 @@ 8, 200, -1, -1, + 0, NULL, false, false @@ -1244,6 +1336,7 @@ 4, 200, -1, -1, + 0, NULL, false, false @@ -1256,6 +1349,7 @@ 1, 50, -1, -1, + 0, NULL, false, true @@ -1268,6 +1362,7 @@ 6, 200, 7, 7, + 0, NULL, true, false @@ -1280,6 +1375,7 @@ 5, 200, -1, -1, + 0, NULL, false, true @@ -1292,6 +1388,7 @@ 3, 200, -1, -1, + 0, NULL, false, true @@ -1304,6 +1401,7 @@ 3, 200, 6, 6, + 0, NULL, true, false @@ -1316,6 +1414,7 @@ 4, 200, -1, -1, + 0, NULL, true, false @@ -1328,6 +1427,7 @@ 5, 200, LOS_RADIUS, LOS_RADIUS, + 0, NULL, false, false @@ -1340,6 +1440,7 @@ 1, 25, 7, 7, + 0, NULL, true, false @@ -1352,6 +1453,7 @@ 2, 200, -1, -1, + 0, NULL, false, true @@ -1364,6 +1466,7 @@ 3, 200, -1, -1, + 0, NULL, false, false @@ -1376,6 +1479,7 @@ 9, 200, 7, 7, + 0, NULL, true, false @@ -1388,6 +1492,7 @@ 5, 200, -1, -1, + 0, NULL, false, false @@ -1400,6 +1505,7 @@ 6, 200, -1, -1, + 0, NULL, false, false @@ -1412,6 +1518,7 @@ 7, 200, -1, -1, + 0, NULL, false, false @@ -1424,6 +1531,7 @@ 2, 0, -1, -1, + 0, NULL, false, false @@ -1436,6 +1544,7 @@ 2, 200, -1, -1, + 0, NULL, false, true @@ -1448,6 +1557,7 @@ 2, 200, -1, -1, + 0, NULL, false, true @@ -1460,6 +1570,7 @@ 2, 200, -1, -1, + 0, NULL, false, true @@ -1472,6 +1583,7 @@ 2, 200, -1, -1, + 0, NULL, false, true @@ -1484,6 +1596,7 @@ 1, 25, 1, 1, + 0, NULL, false, false @@ -1496,6 +1609,7 @@ 6, 200, 5, 5, + 0, NULL, true, false @@ -1508,6 +1622,7 @@ 3, 50, 5, 5, + 0, NULL, true, false @@ -1520,6 +1635,7 @@ 7, 0, -1, -1, + 0, NULL, false, false @@ -1533,6 +1649,7 @@ 6, 200, -1, -1, + 0, NULL, false, true @@ -1545,6 +1662,7 @@ 1, 25, 8, 8, + 0, NULL, true, false @@ -1557,6 +1675,7 @@ 2, 200, -1, -1, + 0, NULL, false, true @@ -1569,6 +1688,7 @@ 4, 200, -1, -1, + 0, NULL, false, true @@ -1581,6 +1701,7 @@ 4, 200, -1, -1, + 0, NULL, false, true @@ -1593,6 +1714,7 @@ 7, 200, 7, 12, + 0, NULL, true, false @@ -1604,7 +1726,8 @@ SPFLAG_MAPPING, 2, 60, // not 50, note the fuzz - -1, -1, + -1, -1, + 0, NULL, false, false @@ -1617,6 +1740,7 @@ 2, 200, -1, -1, + 0, NULL, false, true @@ -1629,6 +1753,7 @@ 4, 200, -1, -1, + 0, NULL, false, true @@ -1641,6 +1766,7 @@ 4, 0, -1, -1, + 0, NULL, false, true @@ -1653,6 +1779,7 @@ 2, 0, -1, -1, + 0, NULL, false, true @@ -1665,6 +1792,7 @@ 4, 200, -1, -1, + 0, NULL, false, true @@ -1677,6 +1805,7 @@ 2, 0, LOS_RADIUS, LOS_RADIUS, + 0, NULL, false, false @@ -1689,6 +1818,7 @@ 7, 0, -1, -1, + 0, NULL, false, false @@ -1701,6 +1831,7 @@ 7, 100, LOS_RADIUS, LOS_RADIUS, + 0, NULL, false, false @@ -1713,6 +1844,7 @@ 3, 0, -1, -1, + 0, NULL, false, true @@ -1725,6 +1857,7 @@ 7, 0, -1, -1, + 0, NULL, false, true @@ -1737,6 +1870,7 @@ 5, 200, LOS_RADIUS, LOS_RADIUS, + 0, NULL, false, false @@ -1749,6 +1883,7 @@ 3, 200, -1, -1, + 0, NULL, false, true @@ -1761,6 +1896,7 @@ 1, 25, 7, 7, + 0, NULL, false, false @@ -1773,6 +1909,7 @@ 6, 200, 6, 6, + 0, NULL, true, false @@ -1785,6 +1922,7 @@ 5, // only removes weapon, so I raised this from 4 -- bwr 200, -1, -1, + 0, NULL, false, true @@ -1797,6 +1935,7 @@ 6, 200, -1, -1, + 0, NULL, false, true @@ -1809,6 +1948,7 @@ 4, // doesn't allow for equipment, so I lowered this from 5 -- bwr 200, -1, -1, + 0, NULL, false, true @@ -1821,6 +1961,7 @@ 8, 200, -1, -1, + 0, NULL, false, true @@ -1833,6 +1974,7 @@ 8, 200, -1, -1, + 0, NULL, false, true @@ -1845,6 +1987,7 @@ 9, 200, -1, -1, + 0, NULL, false, true @@ -1857,6 +2000,7 @@ 6, 0, -1, -1, + 0, NULL, false, false @@ -1869,6 +2013,7 @@ 6, 200, -1, -1, + 0, NULL, false, true @@ -1881,6 +2026,7 @@ 7, 200, 5, 5, + 0, NULL, true, false @@ -1893,6 +2039,7 @@ 4, 100, 6, 6, + 0, NULL, true, false @@ -1905,6 +2052,7 @@ 9, 200, 6, 6, + 0, NULL, true, false @@ -1917,6 +2065,7 @@ 1, 25, 1, 1, + 0, NULL, false, false @@ -1929,6 +2078,7 @@ 4, 200, LOS_RADIUS, LOS_RADIUS, + 0, NULL, false, false @@ -1941,6 +2091,7 @@ 5, 0, -1, -1, + 0, NULL, false, false @@ -1953,6 +2104,7 @@ 1, 200, -1, -1, + 0, NULL, false, false @@ -1965,6 +2117,7 @@ 2, 200, -1, -1, + 0, NULL, false, true @@ -1977,6 +2130,7 @@ 1, 25, 1, 2, + 0, NULL, false, false @@ -1989,6 +2143,7 @@ 3, 200, -1, -1, + 0, NULL, false, true @@ -2001,6 +2156,7 @@ 6, 200, -1, -1, + 0, NULL, false, false @@ -2013,6 +2169,7 @@ 2, 200, -1, -1, + 0, NULL, false, false @@ -2025,6 +2182,7 @@ 3, 200, -1, -1, + 0, NULL, false, false @@ -2037,6 +2195,7 @@ 9, 200, -1, -1, + 0, NULL, false, false @@ -2049,6 +2208,7 @@ 5, 200, -1, -1, + 0, NULL, false, false @@ -2061,6 +2221,7 @@ 2, 56, LOS_RADIUS, LOS_RADIUS, + 0, NULL, true, false @@ -2073,6 +2234,7 @@ 7, 200, -1, -1, + 0, NULL, false, false @@ -2085,6 +2247,7 @@ 1, 0, -1, -1, + 0, NULL, false, true @@ -2097,6 +2260,7 @@ 1, 200, -1, -1, + 0, NULL, false, true @@ -2109,6 +2273,7 @@ 4, 200, -1, -1, + 0, NULL, false, true @@ -2121,6 +2286,7 @@ 5, 200, -1, -1, + 0, NULL, false, true @@ -2133,6 +2299,7 @@ 1, 200, -1, -1, + 0, NULL, false, false @@ -2145,6 +2312,7 @@ 7, // this is high for a reason - Warp brands are very powerful. 0, -1, -1, + 0, NULL, false, true @@ -2157,6 +2325,7 @@ 5, 200, -1, -1, + 0, NULL, false, false @@ -2169,6 +2338,7 @@ 9, 200, -1, -1, + 0, NULL, false, false @@ -2181,6 +2351,7 @@ 7, 200, -1, -1, + 0, NULL, false, false @@ -2193,6 +2364,7 @@ 4, 200, -1, -1, + 0, NULL, false, false @@ -2205,6 +2377,7 @@ 1, 100, 1, 1, + 0, NULL, false, false @@ -2217,6 +2390,7 @@ 1, 200, LOS_RADIUS, LOS_RADIUS, + 0, NULL, true, false @@ -2229,6 +2403,7 @@ 4, 0, -1, -1, + 0, NULL, false, false @@ -2241,6 +2416,7 @@ 2, // XXX: level 2 or 3, what should it be now? -- bwr 200, 6, 6, + 0, NULL, true, false @@ -2253,6 +2429,7 @@ 4, 0, -1, -1, + 0, NULL, false, false @@ -2265,6 +2442,7 @@ 5, 200, LOS_RADIUS, LOS_RADIUS, + 0, "Fragment what (e.g. a wall or monster)?", false, false @@ -2277,6 +2455,7 @@ 9, 200, -1, -1, + 0, NULL, false, true @@ -2289,6 +2468,7 @@ 1, 50, 1, 2, + 0, NULL, true, false @@ -2301,6 +2481,7 @@ 5, 200, LOS_RADIUS, LOS_RADIUS, + 0, NULL, false, false @@ -2313,6 +2494,7 @@ 2, 200, -1, -1, + 0, NULL, false, true @@ -2325,6 +2507,7 @@ 4, 200, -1, -1, + 0, NULL, false, true @@ -2337,6 +2520,7 @@ 3, 100, -1, -1, + 0, NULL, false, true @@ -2349,6 +2533,7 @@ 2, 200, -1, -1, + 0, NULL, false, true @@ -2361,6 +2546,7 @@ 6, 200, -1, -1, + 0, NULL, false, false @@ -2373,6 +2559,7 @@ 7, 200, -1, -1, + 0, NULL, false, false @@ -2385,6 +2572,7 @@ 8, 200, -1, -1, + 0, NULL, false, false @@ -2397,6 +2585,7 @@ 5, // fairly high level - potentially one of the best brands 200, -1, -1, + 0, NULL, false, false @@ -2409,6 +2598,7 @@ 2, 50, 4, 8, + 0, NULL, false, false @@ -2421,6 +2611,7 @@ 5, 200, -1, -1, + 0, NULL, false, false @@ -2433,6 +2624,7 @@ 9, 200, LOS_RADIUS, LOS_RADIUS, + 0, NULL, true, false @@ -2445,6 +2637,7 @@ 3, 0, -1, -1, + 0, NULL, false, false @@ -2457,6 +2650,7 @@ 3, 0, LOS_RADIUS, LOS_RADIUS, + 0, NULL, false, false @@ -2469,6 +2663,7 @@ 3, 0, -1, -1, + 0, NULL, false, false @@ -2481,6 +2676,7 @@ 4, 0, 7, 7, + 0, NULL, true, false @@ -2493,6 +2689,7 @@ 4, 0, -1, -1, + 0, NULL, false, false @@ -2505,6 +2702,7 @@ 4, 0, -1, -1, + 0, NULL, false, false @@ -2517,6 +2715,7 @@ 4, 0, 8, 8, + 0, NULL, true, false @@ -2529,6 +2728,7 @@ 2, 0, 7, 7, + 0, NULL, true, false @@ -2541,6 +2741,7 @@ 7, 0, -1, -1, + 0, NULL, false, false, @@ -2553,6 +2754,7 @@ 1, 0, -1, -1, + 1, // SPTYP_NONE spells have no default noise level NULL, false, false @@ -2565,6 +2767,7 @@ 5, 0, 8, 8, + 0, NULL, true, false @@ -2577,6 +2780,7 @@ 5, 0, 5, 5, + 0, NULL, true, false @@ -2589,6 +2793,7 @@ 6, 0, 6, 6, + 0, NULL, true, false @@ -2601,6 +2806,7 @@ 6, 0, -1, -1, + 0, NULL, false, false @@ -2613,6 +2819,7 @@ 2, 0, LOS_RADIUS, LOS_RADIUS, + 0, NULL, true, false @@ -2625,6 +2832,7 @@ 4, 0, -1, -1, + 0, NULL, false, false @@ -2637,6 +2845,7 @@ 0, 0, -1, -1, + 0, NULL, false, false diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc index d2fde2f04a..592da11f61 100644 --- a/crawl-ref/source/spl-util.cc +++ b/crawl-ref/source/spl-util.cc @@ -40,6 +40,31 @@ #include #endif +struct spell_desc +{ + int id; + const char *title; + unsigned int disciplines; // bitfield + unsigned int flags; // bitfield + unsigned int level; + int power_cap; + + // At power 0, you get min_range. At power power_cap, you get max_range. + int min_range; + int max_range; + + // How much louder or quieter the spell is than the default. + int noise_mod; + + const char *target_prompt; + + // If a monster is casting this, does it need a tracer? + bool ms_needs_tracer; + + // The spell can be used no matter what the monster's foe is. + bool ms_utility; +}; + static struct spell_desc spelldata[] = { #include "spl-data.h" }; @@ -922,3 +947,22 @@ int spell_range(spell_type spell, int pow, bool real_cast) // Round appropriately. return ((pow*(maxrange - minrange) + powercap/2) / powercap + minrange); } + +int spell_noise(spell_type spell) +{ + const spell_desc *desc = _seekspell(spell); + + return desc->noise_mod + spell_noise(desc->disciplines, desc->level); +} + +int spell_noise(unsigned int disciplines, int level) +{ + if (disciplines == SPTYP_NONE) + return (0); + else if (disciplines & SPTYP_CONJURATION) + return (level); + else if (disciplines && !(disciplines & (SPTYP_POISON | SPTYP_AIR))) + return div_round_up(level * 3, 4); + else + return div_round_up(level, 2); +} diff --git a/crawl-ref/source/spl-util.h b/crawl-ref/source/spl-util.h index 789ab34f41..c41fa1bb4f 100644 --- a/crawl-ref/source/spl-util.h +++ b/crawl-ref/source/spl-util.h @@ -37,30 +37,6 @@ enum spschool_flag_type struct bolt; struct dist; -struct spell_desc -{ - int id; - const char *title; - unsigned int disciplines; // bitfield - unsigned int flags; // bitfield - unsigned int level; - int power_cap; - - // At power 0, you get min_range. At power power_cap, you get max_range. - int min_range; - int max_range; - - const char *target_prompt; - - - // If a monster is casting this, does it need a tracer? - bool ms_needs_tracer; - - // The spell can be used no matter what the monster's foe is. - bool ms_utility; -}; - - bool is_valid_spell(spell_type spell); void init_spell_descs(void); void init_spell_name_cache(); @@ -79,6 +55,8 @@ int spell_mana(spell_type which_spell); int spell_difficulty(spell_type which_spell); int spell_power_cap(spell_type spell); int spell_range(spell_type spell, int pow, bool real_cast); +int spell_noise(spell_type spell); +int spell_noise(unsigned int disciplines, int level); const char *get_spell_target_prompt( spell_type which_spell ); -- cgit v1.2.3-54-g00ecf