fix #H7536 - pet vampire behavior

Vampires tend to take vampire bat form and stay that way, unless/until
there's a closed door they want to pass in which case they change to
fog cloud form.  Those shifted forms are weak, so pet vampires tend
not to attack other monsters, and if they don't take damage, they
won't change to vampire form.  So, when comparing relative strength of
self and foe while deciding whether to attack another monster, treat
their own strength in weak form as if in vampire form, making them be
more aggressive.

Hostile vampires shouldn't need any comparable change.  They don't use
relative strengths when deciding whether to attack something.
This commit is contained in:
PatR
2018-11-13 16:29:48 -08:00
parent a97d0b7270
commit bd4cacbc52
2 changed files with 20 additions and 2 deletions

View File

@@ -197,6 +197,7 @@ avoid potential buffer overflow if object with very long name knocks other
clairvoyance would show trap instead of a monster on/in that trap, which was
intentional, but when clairvoyance finished the monster wasn't shown
nurse corpse/tin chance to convey poison resistance when eaten was not honored
make tame vampires be more aggressive when shifted to bat/fog/wolf form
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository

View File

@@ -721,6 +721,7 @@ struct monst *mtmp, *mtarg;
/* Give 1 in 3 chance of safe breathing even if pet is confused or
* if you're on the quest start level */
if (!mtmp->mconf || !rn2(3) || Is_qstart(&u.uz)) {
int mtmp_lev;
aligntyp align1 = A_NONE, align2 = A_NONE; /* For priests, minions */
boolean faith1 = TRUE, faith2 = TRUE;
@@ -774,10 +775,26 @@ struct monst *mtmp, *mtarg;
|| (mtmp->m_lev > 12 && mtarg->m_lev < mtmp->m_lev - 9
&& u.ulevel > 8 && mtarg->m_lev < u.ulevel - 7))
score -= 25;
/* for strength purposes, a vampshifter in weak form (vampire bat,
fog cloud, maybe wolf) will attack as if in vampire form;
otherwise if won't do much and usually wouldn't suffer enough
damage (from counterattacks) to switch back to vampire form;
make it be more aggressive by behaving as if stronger */
mtmp_lev = mtmp->m_lev;
if (is_vampshifter(mtmp) && mtmp->data->mlet != S_VAMPIRE) {
/* is_vampshifter() implies (mtmp->cham >= LOW_PM) */
mtmp_lev = mons[mtmp->cham].mlevel;
/* actual vampire level would range from 1.0*mlvl to 1.5*mlvl */
mtmp_lev += rn2(mtmp_lev / 2 + 1);
/* we don't expect actual level in weak form to exceed
base level of strong form, but handle that if it happens */
if (mtmp->m_lev > mtmp_lev)
mtmp_lev = mtmp->m_lev;
}
/* And pets will hesitate to attack vastly stronger foes.
This penalty will be discarded if master's in trouble. */
if (mtarg->m_lev > mtmp->m_lev + 4L)
score -= (mtarg->m_lev - mtmp->m_lev) * 20L;
if (mtarg->m_lev > mtmp_lev + 4L)
score -= (mtarg->m_lev - mtmp_lev) * 20L;
/* All things being the same, go for the beefiest monster. This
bonus should not be large enough to override the pet's aversion
to attacking much stronger monsters. */