diff options
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/dat/database/monspell.txt | 34 | ||||
-rw-r--r-- | crawl-ref/source/mon-abil.cc | 14 | ||||
-rw-r--r-- | crawl-ref/source/mon-cast.cc | 73 | ||||
-rw-r--r-- | crawl-ref/source/mon-cast.h | 5 |
4 files changed, 92 insertions, 34 deletions
diff --git a/crawl-ref/source/dat/database/monspell.txt b/crawl-ref/source/dat/database/monspell.txt index 05aff5a894..263005034e 100644 --- a/crawl-ref/source/dat/database/monspell.txt +++ b/crawl-ref/source/dat/database/monspell.txt @@ -2,21 +2,25 @@ # "The wizard mumbles some strange words." The messages are looked # up in the following order by the following keys: # -# 1) The name of the spell being cast: +# 1) If the monster is a wizard or priest which has been polymorphed into +# a wizard without hands which is trying to cast a spell it kept across +# the polymporh, then the first key will be "polymorphed wizard" or +# "polymorphed priest". +# 2) The name of the spell being cast: # a) If being cast by a wizard or priest monster with arms, first try # with the suffix "real". # b) If being cast by a monster of normal or higher intelligence with arms, # try with the suffix "gestures". # c) Next, try without any suffix. -# 2) The name of the monster's type. -# 3) The name of the monster's species. -# 4) The name of the monster's genus. -# 5) "priest" if the monster is a priest type, "wizard" if it's a wizard type, +# 3) The name of the monster's type. +# 4) The name of the monster's species. +# 5) The name of the monster's genus. +# 6) "priest" if the monster is a priest type, "wizard" if it's a wizard type, # or "demon" if it's demonic. -# 6) If the spell uses a targeted, visible beam, it will try +# 7) If the spell uses a targeted, visible beam, it will try # "<beam_short_name> beam cast", then "beam catchall cast". # -# For 2 to 5, if the spell has a target it will first add the suffix +# For 1 and 3 to 6, if the spell has a target it will first add the suffix # "targeted" to the lookup key before trying without the suffix. # # For all lookups, if the monster is unseen by the player it will add the @@ -241,6 +245,22 @@ giant eyeball cast targeted giant eyeball cast @The_monster@ looks around. +########################################################################### +# Generic messages for priests and wizards which have been polymorphed into +# something without hands. +########################################################################### +%%%% +polymorphed wizard cast targeted + +@The_monster@ casts a spell at @target@. +%%%% +polymorphed wizard cast + +@The_monster@ casts a spell. +%%%% +polymorphed unseen wizard cast + +You hear some strange, mumbled words. ###################################################### # Generic priest, wizard and demonic casting messages. ###################################################### diff --git a/crawl-ref/source/mon-abil.cc b/crawl-ref/source/mon-abil.cc index 15cb21337d..a8037d2733 100644 --- a/crawl-ref/source/mon-abil.cc +++ b/crawl-ref/source/mon-abil.cc @@ -746,6 +746,12 @@ static bool _moth_incite_monsters(const monsters *mon) return (false); } +static inline void _mons_cast_abil(monsters *monster, bolt &pbolt, + spell_type spell_cast) +{ + mons_cast(monster, pbolt, spell_cast, true, true); +} + //--------------------------------------------------------------- // // mon_special_ability @@ -943,7 +949,7 @@ bool mon_special_ability(monsters *monster, bolt & beem) if (mons_should_fire(beem)) { make_mons_stop_fleeing(monster); - mons_cast(monster, beem, spell); + _mons_cast_abil(monster, beem, spell); used = true; } } @@ -1004,7 +1010,7 @@ bool mon_special_ability(monsters *monster, bolt & beem) { make_mons_stop_fleeing(monster); spell_cast = SPELL_SYMBOL_OF_TORMENT; - mons_cast(monster, beem, spell_cast); + _mons_cast_abil(monster, beem, spell_cast); used = true; break; } @@ -1023,7 +1029,7 @@ bool mon_special_ability(monsters *monster, bolt & beem) { make_mons_stop_fleeing(monster); - mons_cast(monster, beem, spell_cast); + _mons_cast_abil(monster, beem, spell_cast); used = true; } break; @@ -1137,7 +1143,7 @@ bool mon_special_ability(monsters *monster, bolt & beem) if (mons_should_fire(beem)) { make_mons_stop_fleeing(monster); - mons_cast(monster, beem, spell); + _mons_cast_abil(monster, beem, spell); used = true; } } diff --git a/crawl-ref/source/mon-cast.cc b/crawl-ref/source/mon-cast.cc index 798dba18fd..b1ae67a26e 100644 --- a/crawl-ref/source/mon-cast.cc +++ b/crawl-ref/source/mon-cast.cc @@ -1538,7 +1538,7 @@ void mons_cast_haunt(monsters *monster) } void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast, - bool do_noise) + bool do_noise, bool special_ability) { // Always do setup. It might be done already, but it doesn't hurt // to do it again (cheap). @@ -1566,14 +1566,15 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast, if (monsterNearby) { if (do_noise) - mons_cast_noise(monster, pbolt, spell_cast); + mons_cast_noise(monster, pbolt, spell_cast, + special_ability); direct_effect(monster, spell_cast, pbolt, &you); } return; } if (do_noise) - mons_cast_noise(monster, pbolt, spell_cast); + mons_cast_noise(monster, pbolt, spell_cast, special_ability); direct_effect(monster, spell_cast, pbolt, monster->get_foe()); return; } @@ -1588,7 +1589,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast, #endif if (do_noise) - mons_cast_noise(monster, pbolt, spell_cast); + mons_cast_noise(monster, pbolt, spell_cast, special_ability); // If the monster's a priest, assume summons come from priestly // abilities, in which case they'll have the same god. If the @@ -2156,11 +2157,12 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast, pbolt.fire(); } -void mons_cast_noise(monsters *monster, bolt &pbolt, spell_type spell_cast) +void mons_cast_noise(monsters *monster, bolt &pbolt, spell_type spell_cast, + bool special_ability) { bool force_silent = false; - spell_type real_spell = spell_cast; + spell_type actual_spell = spell_cast; if (spell_cast == SPELL_DRACONIAN_BREATH) { @@ -2171,11 +2173,11 @@ void mons_cast_noise(monsters *monster, bolt &pbolt, spell_type spell_cast) switch (type) { case MONS_MOTTLED_DRACONIAN: - real_spell = SPELL_STICKY_FLAME_SPLASH; + actual_spell = SPELL_STICKY_FLAME_SPLASH; break; case MONS_YELLOW_DRACONIAN: - real_spell = SPELL_ACID_SPLASH; + actual_spell = SPELL_ACID_SPLASH; break; case MONS_PLAYER_GHOST: @@ -2198,12 +2200,12 @@ void mons_cast_noise(monsters *monster, bolt &pbolt, spell_type spell_cast) if (unseen && silent) return; - const unsigned int flags = get_spell_flags(real_spell); + const unsigned int flags = get_spell_flags(actual_spell); const bool priest = monster->is_priest(); const bool wizard = monster->is_actual_spellcaster(); const bool innate = !(priest || wizard || no_silent) - || (flags & SPFLAG_INNATE); + || (flags & SPFLAG_INNATE) || special_ability; int noise; if (silent @@ -2223,26 +2225,62 @@ void mons_cast_noise(monsters *monster, bolt &pbolt, spell_type spell_cast) // Noise for targeted spells happens at where the spell hits, // rather than where the spell is cast. zappy() sets up the // noise for beams. - noise = (flags & SPFLAG_TARGETTING_MASK) ? 1 - : spell_noise(real_spell); + noise = (flags & SPFLAG_TARGETTING_MASK) + ? 1 : spell_noise(actual_spell); } } const std::string cast_str = " cast"; - const std::string spell_name = spell_title(real_spell); + const std::string spell_name = spell_title(actual_spell); const mon_body_shape shape = get_mon_shape(monster); + const bool real_spell = !innate && (priest || wizard); + + const bool visible_beam = pbolt.type != 0 && pbolt.type != ' ' + && pbolt.name[0] != '0' + && !pbolt.is_enchantment(); + const bool targeted = (flags & SPFLAG_TARGETTING_MASK) + && (pbolt.target != monster->pos() || visible_beam); std::vector<std::string> key_list; // First try the spells name. if (shape <= MON_SHAPE_NAGA) { - if (!innate && (priest || wizard)) + if (real_spell) key_list.push_back(spell_name + cast_str + " real"); if (mons_intel(monster) >= I_NORMAL) key_list.push_back(spell_name + cast_str + " gestures"); } + else if (real_spell) + { + // A real spell being cast by something with no hands? Maybe + // it's a polymorphed spellcaster which kept its original spells. + // If so, the cast message for it's new type/species/genus probably + // won't look right. + if (!mons_class_flag(monster->type, M_ACTUAL_SPELLS | M_PRIEST)) + { + // XXX: We should probably include the monster's shape, + // to get a variety of messages. + if (wizard) + { + std::string key = "polymorphed wizard" + cast_str; + key_list.push_back(key); + + if (targeted) + key_list.push_back(key + " targeted"); + } + else if (priest) + { + std::string key = "polymorphed priest" + cast_str; + key_list.push_back(key); + + if (targeted) + key_list.push_back(key + " targeted"); + } + } + } + key_list.push_back(spell_name + cast_str); const unsigned int num_spell_keys = key_list.size(); @@ -2262,13 +2300,6 @@ void mons_cast_noise(monsters *monster, bolt &pbolt, spell_type spell_cast) else if (mons_is_demon(monster->type)) key_list.push_back("demon" + cast_str); - const bool visible_beam = pbolt.type != 0 && pbolt.type != ' ' - && pbolt.name[0] != '0' - && !pbolt.is_enchantment(); - - const bool targeted = (flags & SPFLAG_TARGETTING_MASK) - && (pbolt.target != monster->pos() || visible_beam); - if (targeted) { // For targeted spells, try with the targeted suffix first. diff --git a/crawl-ref/source/mon-cast.h b/crawl-ref/source/mon-cast.h index 390f563875..896c377ceb 100644 --- a/crawl-ref/source/mon-cast.h +++ b/crawl-ref/source/mon-cast.h @@ -20,8 +20,9 @@ bool handle_mon_spell(monsters *monster, bolt &beem); bolt mons_spells(monsters *mons, spell_type spell_cast, int power, bool check_validity = false); 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); + bool do_noise = true, bool special_ability = false); +void mons_cast_noise(monsters *monster, bolt &pbolt, spell_type spell_cast, + bool special_ability = false); bool setup_mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast, bool check_validity = false); |