Pets are more careful about attacking monsters at low health
Another SliceHack feature. However, the math implemented by SliceHack seemed incorrect, so I tweaked it. Pets previously attacked monsters of up to one level higher than them as long as they were above 25% health. Now, they will attack monsters as follows: 100%: up to level + 2 (pets could not attack this high before) 80%+: up to level + 1 60%+: up to same level 40%+: up to level - 1 25%+: up to level - 2 The case that prevents any attacks below 25% health still exists.
This commit is contained in:
committed by
Pasi Kallinen
parent
6b60618e0e
commit
882efdcf58
@@ -531,6 +531,7 @@ make anti-magic fields drain more energy and prevent them from showing up
|
||||
too early in the dungeon
|
||||
eating magical monsters such as wizards or shamans may give a mild buzz
|
||||
make exploding spheres create an actual explosion
|
||||
pets are more careful about attacking monsters at low health
|
||||
|
||||
|
||||
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
|
||||
|
||||
@@ -971,8 +971,18 @@ dog_move(register struct monst *mtmp,
|
||||
if ((info[i] & ALLOW_M) && MON_AT(nx, ny)) {
|
||||
int mstatus;
|
||||
register struct monst *mtmp2 = m_at(nx, ny);
|
||||
/* weight the audacity of the pet to attack a differently-leveled
|
||||
* foe based on its fraction of max HP:
|
||||
* 100%: up to level + 2
|
||||
* 80% and up: up to level + 1
|
||||
* 60% to 80%: up to level
|
||||
* 40% to 60%: up to level - 1
|
||||
* 25% to 40%: up to level - 2
|
||||
* below 25%: prevented from attacking at all by a different case
|
||||
*/
|
||||
int balk = mtmp->m_lev + ((5 * mtmp->mhp) / mtmp->mhpmax) - 2;
|
||||
|
||||
if ((int) mtmp2->m_lev >= (int) mtmp->m_lev + 2
|
||||
if ((int) mtmp2->m_lev >= balk
|
||||
|| (mtmp2->data == &mons[PM_FLOATING_EYE] && rn2(10)
|
||||
&& mtmp->mcansee && haseyes(mtmp->data) && mtmp2->mcansee
|
||||
&& (perceives(mtmp->data) || !mtmp2->minvis))
|
||||
|
||||
Reference in New Issue
Block a user