git pull request #133 - reassess worn equipment

Fixes #133

Monsters who lost an amulet of life saving while having their life
saved wouldn't attempt to put on another amulet unless/until they
picked up some object.  Likewise if they had a worn item stolen.
(There are probably other events which should re-check worn gear.)

The suggested commit had a life-saved monster re-check equipment
during life-saving which might have led to reports about them
effectively getting extra moves, especially if two-weapon fighting
or zap rebound with sequence of kill/life-save/kill-again allowed
the target to put on a replacement amulet of life-saving prior to
the second kill.  It also wasn't amenable to dealing with stolen
equipment.  This alternate fix sets a flag to have monster check
its equipment on its next move.
This commit is contained in:
PatR
2018-09-14 15:08:22 -07:00
parent e37087e999
commit 2c231f57bd
4 changed files with 29 additions and 6 deletions
+3
View File
@@ -117,6 +117,9 @@ for hilite_status of string status fields (title, dungeon-level, alignment),
jumping into or over a Sokoban pit, or over a fire trap, triggers trap twice jumping into or over a Sokoban pit, or over a fire trap, triggers trap twice
mimics created by #wizgenesis could block or not block vision incorrectly mimics created by #wizgenesis could block or not block vision incorrectly
handle monsters inside the invocation area handle monsters inside the invocation area
give monsters who have had a worn item stolen or who have been life-saved
(used up amulet) a chance to wear replacement gear on next move
instead of having to wait until they pick something up
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository
+3
View File
@@ -1268,6 +1268,9 @@ register struct attack *mattk;
mwepgone(mdef); mwepgone(mdef);
otmp->owornmask = 0L; otmp->owornmask = 0L;
update_mon_intrinsics(mdef, otmp, FALSE, FALSE); update_mon_intrinsics(mdef, otmp, FALSE, FALSE);
/* give monster a chance to wear other equipment on its next
move instead of waiting until it picks something up */
mdef->misc_worn_check |= I_SPECIAL;
} }
/* add_to_minv() might free otmp [if it merges] */ /* add_to_minv() might free otmp [if it merges] */
if (vis) if (vis)
+20 -6
View File
@@ -731,6 +731,17 @@ movemon()
if (minliquid(mtmp)) if (minliquid(mtmp))
continue; continue;
/* after losing equipment, try to put on replacement */
if (mtmp->misc_worn_check & I_SPECIAL) {
long oldworn;
mtmp->misc_worn_check &= ~I_SPECIAL;
oldworn = mtmp->misc_worn_check;
m_dowear(mtmp, FALSE);
if (mtmp->misc_worn_check != oldworn || !mtmp->mcanmove)
continue;
}
if (is_hider(mtmp->data)) { if (is_hider(mtmp->data)) {
/* unwatched mimics and piercers may hide again [MRS] */ /* unwatched mimics and piercers may hide again [MRS] */
if (restrap(mtmp)) if (restrap(mtmp))
@@ -1796,6 +1807,8 @@ struct monst *mtmp;
pline_The("medallion crumbles to dust!"); pline_The("medallion crumbles to dust!");
} }
m_useup(mtmp, lifesave); m_useup(mtmp, lifesave);
/* equip replacement amulet, if any, on next move */
mtmp->misc_worn_check |= I_SPECIAL;
surviver = !(mvitals[monsndx(mtmp->data)].mvflags & G_GENOD); surviver = !(mvitals[monsndx(mtmp->data)].mvflags & G_GENOD);
mtmp->mcanmove = 1; mtmp->mcanmove = 1;
@@ -1806,13 +1819,14 @@ struct monst *mtmp;
if (mtmp->mhpmax <= 0) if (mtmp->mhpmax <= 0)
mtmp->mhpmax = 10; mtmp->mhpmax = 10;
mtmp->mhp = mtmp->mhpmax; mtmp->mhp = mtmp->mhpmax;
if (surviver)
return;
/* genocided monster can't be life-saved */ if (!surviver) {
if (cansee(mtmp->mx, mtmp->my)) /* genocided monster can't be life-saved */
pline("Unfortunately, %s is still genocided...", mon_nam(mtmp)); if (cansee(mtmp->mx, mtmp->my))
mtmp->mhp = 0; pline("Unfortunately, %s is still genocided...",
mon_nam(mtmp));
mtmp->mhp = 0;
}
} }
} }
+3
View File
@@ -1484,6 +1484,9 @@ struct attack *mattk;
setmnotwielded(mdef, otmp); setmnotwielded(mdef, otmp);
otmp->owornmask = 0L; otmp->owornmask = 0L;
update_mon_intrinsics(mdef, otmp, FALSE, FALSE); update_mon_intrinsics(mdef, otmp, FALSE, FALSE);
/* give monster a chance to wear other equipment on its next
move instead of waiting until it picks something up */
mdef->misc_worn_check |= I_SPECIAL;
if (otmp == stealoid) /* special message for final item */ if (otmp == stealoid) /* special message for final item */
pline("%s finishes taking off %s suit.", Monnam(mdef), pline("%s finishes taking off %s suit.", Monnam(mdef),