fix github issue #111 - stone-to-flesh of statues

Fixes #111

Casting stone-to-flesh at a random statue animates it as a monster
(created via direct call to makemon()) at an adjacent or nearby spot
if there is already a monster at the statue's spot, but doing so on
a statue of a petrified monster (create attempt via montraits() which
called makemon() without the ADJACENTOK flag) turned it into a corpse
instead.  Pass an extra argument to montraits() so that it behaves
the same normal statue animation for stone-to-flesh without changing
how it behaves when reviving corpses for undead-turning.
This commit is contained in:
PatR
2018-07-03 14:59:34 -07:00
parent 7af51743b7
commit 335e868865
4 changed files with 11 additions and 6 deletions

View File

@@ -54,7 +54,10 @@ highlighting status conditions would fail to use attributes if a rule with
them was followed by another one without (color only or color&normal)
when using 'O' to set hilite_status rules, hide the 'score' status field if
game has been built without SCORE_ON_BOTL; latent rules for 'score'
can still be set in config file but can't be added or removed via 'O'
can still be set in config file and removed via 'O' but can't be added
make stone-to-flesh behave the same on statues of petrified monsters as it
does on random 'dungeon art' ones (revive at a nearby spot instead of
becoming a corpse when there's already a monster at statue's location)
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository

View File

@@ -2860,7 +2860,7 @@ E boolean FDECL(get_obj_location, (struct obj *, xchar *, xchar *, int));
E boolean FDECL(get_mon_location, (struct monst *, xchar *, xchar *, int));
E struct monst *FDECL(get_container_location,
(struct obj * obj, int *, int *));
E struct monst *FDECL(montraits, (struct obj *, coord *));
E struct monst *FDECL(montraits, (struct obj *, coord *, BOOLEAN_P));
E struct monst *FDECL(revive, (struct obj *, BOOLEAN_P));
E int FDECL(unturn_dead, (struct monst *));
E void FDECL(cancel_item, (struct obj *));

View File

@@ -595,7 +595,7 @@ int *fail_reason;
if (use_saved_traits) {
/* restore a petrified monster */
cc.x = x, cc.y = y;
mon = montraits(statue, &cc);
mon = montraits(statue, &cc, (cause == ANIMATE_SPELL));
if (mon && mon->mtame && !mon->isminion)
wary_dog(mon, TRUE);
} else {

View File

@@ -555,9 +555,10 @@ int locflags; /* non-zero means get location even if monster is buried */
/* used by revive() and animate_statue() */
struct monst *
montraits(obj, cc)
montraits(obj, cc, adjacentok)
struct obj *obj;
coord *cc;
boolean adjacentok; /* False: at obj's spot only, True: nearby is allowed */
{
struct monst *mtmp = (struct monst *) 0;
struct monst *mtmp2 = (struct monst *) 0;
@@ -570,7 +571,8 @@ coord *cc;
if (mtmp2->mhpmax <= 0 && !is_rider(mtmp2->data))
return (struct monst *) 0;
mtmp = makemon(mtmp2->data, cc->x, cc->y,
NO_MINVENT | MM_NOWAIT | MM_NOCOUNTBIRTH);
(NO_MINVENT | MM_NOWAIT | MM_NOCOUNTBIRTH
| (adjacentok ? MM_ADJACENTOK : 0)));
if (!mtmp)
return mtmp;
@@ -786,7 +788,7 @@ boolean by_hero;
} else if (has_omonst(corpse)) {
/* use saved traits */
xy.x = x, xy.y = y;
mtmp = montraits(corpse, &xy);
mtmp = montraits(corpse, &xy, FALSE);
if (mtmp && mtmp->mtame && !mtmp->isminion)
wary_dog(mtmp, TRUE);
} else {