Skip to content

Commit

Permalink
Tell player if monster can never be recited to (m-aigner / 10416)
Browse files Browse the repository at this point in the history
This adapts m-aigner's code from #379

The previous messaging seemed to have been actively wrong (the HD
calculation is different than what seems to happen in god-abil.cc), so I
decided it was time to finally merge a version of this, fixing the crash
discussed in the PR thread. The new version still only checks particular
monsters, so as discussed in the PR thread, something that looks at a
monster_info might be desireable. In principle this more accurate info
can leak information about a monster's spellset, but for that to happen,
I think there would have to be something like a monster with multiple
spellsets and subhuman intelligence, which as far as I can tell doesn't
exist right now.  Calculating over monster_info might deal with that
case as well, if it were to ever come about.

Resolves #379
  • Loading branch information
rawlins committed Mar 4, 2018
1 parent 5284510 commit e769cdc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
27 changes: 13 additions & 14 deletions crawl-ref/source/describe.cc
Expand Up @@ -3733,23 +3733,22 @@ static string _monster_stat_description(const monster_info& mi)
if (mon_size)
result << uppercase_first(pronoun) << " is " << mon_size << ".\n";

if (in_good_standing(GOD_ZIN, 0))
{
const int check = mi.hd - zin_recite_power();
if (check >= 0)
{
result << uppercase_first(pronoun) << " is too strong to be"
" recited to.";
}
else if (check >= -5)
if (in_good_standing(GOD_ZIN, 0) && !mi.pos.origin() && monster_at(mi.pos))
{
recite_counts retval;
monster *m = monster_at(mi.pos);
auto eligibility = zin_check_recite_to_single_monster(m, retval);
if (eligibility == RE_INELIGIBLE)
result << "Reciting Zin's laws will not affect " << pronoun << ".";
else if (eligibility == RE_TOO_STRONG)
{
result << uppercase_first(pronoun) << " may be too strong to be"
" recited to.";
result << uppercase_first(pronoun) <<
" is too strong to be affected by reciting Zin's laws.";
}
else
else // RE_ELIGIBLE || RE_RECITE_TIMER
{
result << uppercase_first(pronoun) << " is weak enough to be"
" recited to.";
result << uppercase_first(pronoun) <<
" can be affected by reciting Zin's laws to it.";
}

if (you.wizard)
Expand Down
2 changes: 1 addition & 1 deletion crawl-ref/source/god-abil.cc
Expand Up @@ -620,7 +620,7 @@ static int _heretic_recite_weakness(const monster *mon)
&& !(mon->has_ench(ENCH_DUMB) || mons_is_confused(*mon)))
{
// In the eyes of Zin, everyone is a sinner until proven otherwise!
degree++;
degree++;

// Any priest is a heretic...
if (mon->is_priest())
Expand Down

0 comments on commit e769cdc

Please sign in to comment.