Blessed potion of polymorph asks user for monster to poly into

... unless there's some other form that would override the choice,
such as a worn dragon armor, lycanthropy, or vampirism.

The polymorph will be in effect for 10-24 turns.
This commit is contained in:
Pasi Kallinen
2022-07-14 14:04:24 +03:00
parent 67ec92165e
commit 486ed29077
12 changed files with 40 additions and 17 deletions

View File

@@ -957,6 +957,7 @@ if #wizmakemap was used to generate a replacement level while any shopkeeper,
temple priest, or vault guard from the level was off of it at the
time, the monster's eshk, epri, or egd data became invalid and would
cause trouble if the monster returned to its 'home' level
blessed potion of polymorph will prompt user for monster to poly into
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

View File

@@ -81,6 +81,15 @@ enum dismount_types {
DISMOUNT_BYCHOICE = 6
};
/* polyself flags */
enum polyself_flags {
POLY_NOFLAGS = 0x00,
POLY_CONTROLLED = 0x01,
POLY_MONSTER = 0x02,
POLY_REVERT = 0x04,
POLY_LOW_CTRL = 0x08
};
/* sellobj_state() states */
#define SELL_NORMAL (0)
#define SELL_DELIBERATE (1)

View File

@@ -292,7 +292,7 @@ moveloop_core(void)
if (g.multi >= 0) {
stop_occupation();
if (mvl_change == 1)
polyself(0);
polyself(POLY_NOFLAGS);
else
you_were();
mvl_change = 0;

View File

@@ -1490,7 +1490,7 @@ wiz_panic(void)
static int
wiz_polyself(void)
{
polyself(1);
polyself(POLY_CONTROLLED);
return ECMD_OK;
}

View File

@@ -1194,7 +1194,7 @@ cpostfx(int pm)
You("%s.", (pm == PM_GENETIC_ENGINEER)
? "undergo a freakish metamorphosis"
: "feel a change coming over you");
polyself(0);
polyself(POLY_NOFLAGS);
}
break;
case PM_DISPLACER_BEAST:

View File

@@ -632,7 +632,7 @@ drinksink(void)
pline("This %s contains toxic wastes!", hliquid("water"));
if (!Unchanging) {
You("undergo a freakish metamorphosis!");
polyself(0);
polyself(POLY_NOFLAGS);
}
break;
/* more odd messages --JJB */

View File

@@ -992,7 +992,7 @@ mon_poly(struct monst *magr, struct monst *mdef, int dmg)
/* system shock might take place in polyself() */
if (u.ulycn == NON_PM) {
You("are subjected to a freakish metamorphosis.");
polyself(0);
polyself(POLY_NOFLAGS);
} else if (u.umonnum != u.ulycn) {
You_feel("an unnatural urge coming on.");
you_were();

View File

@@ -438,9 +438,10 @@ polyself(int psflags)
{
char buf[BUFSZ];
int old_light, new_light, mntmp, class, tryct, gvariant = NEUTRAL;
boolean forcecontrol = (psflags == 1),
monsterpoly = (psflags == 2),
formrevert = (psflags == 3),
boolean forcecontrol = ((psflags & POLY_CONTROLLED) != 0),
low_control = ((psflags & POLY_LOW_CTRL) != 0),
monsterpoly = ((psflags & POLY_MONSTER) != 0),
formrevert = ((psflags & POLY_REVERT) != 0),
draconian = (uarm && Is_dragon_armor(uarm)),
iswere = (u.ulycn >= LOW_PM),
isvamp = (is_vampire(g.youmonst.data)
@@ -469,6 +470,11 @@ polyself(int psflags)
monsterpoly = TRUE;
controllable_poly = FALSE;
}
if (forcecontrol && low_control
&& (draconian || monsterpoly || isvamp || iswere))
forcecontrol = FALSE;
if (monsterpoly && isvamp)
goto do_vampyr;
@@ -1681,7 +1687,7 @@ dopoly(void)
struct permonst *savedat = g.youmonst.data;
if (is_vampire(g.youmonst.data) || is_vampshifter(&g.youmonst)) {
polyself(2);
polyself(POLY_MONSTER);
if (savedat != g.youmonst.data) {
You("transform into %s.",
an(pmname(g.youmonst.data, Ugender)));

View File

@@ -1295,11 +1295,18 @@ peffect_acid(struct obj *otmp)
}
static void
peffect_polymorph(struct obj *otmp UNUSED)
peffect_polymorph(struct obj *otmp)
{
You_feel("a little %s.", Hallucination ? "normal" : "strange");
if (!Unchanging)
polyself(0);
if (!Unchanging) {
if (!otmp->blessed || (u.umonnum != u.umonster))
polyself(POLY_NOFLAGS);
else {
polyself(POLY_CONTROLLED|POLY_LOW_CTRL);
if (u.mtimedone && u.umonnum != u.umonster)
u.mtimedone = min(u.mtimedone, rn2(15) + 10);
}
}
}
int
@@ -1654,7 +1661,7 @@ potionhit(struct monst *mon, struct obj *obj, int how)
case POT_POLYMORPH:
You_feel("a little %s.", Hallucination ? "normal" : "strange");
if (!Unchanging && !Antimagic)
polyself(0);
polyself(POLY_NOFLAGS);
break;
case POT_ACID:
if (!Acid_resistance) {

View File

@@ -2550,7 +2550,7 @@ do_class_genocide(void)
if (Upolyd && vampshifted(&g.youmonst)
/* current shifted form or base vampire form */
&& (i == u.umonnum || i == g.youmonst.cham))
polyself(3); /* vampshifter back to vampire */
polyself(POLY_REVERT); /* vampshifter back to vampire */
if (Upolyd && i == u.umonnum) {
u.mh = -1;
if (Unchanging) {
@@ -2673,7 +2673,7 @@ do_genocide(int how)
/* first revert if current shifted form or base vampire form */
if (Upolyd && vampshifted(&g.youmonst)
&& (mndx == u.umonnum || mndx == g.youmonst.cham))
polyself(3); /* vampshifter (bat, &c) back to vampire */
polyself(POLY_REVERT); /* vampshifter (bat, &c) back to vampire */
/* Although "genus" is Latin for race, the hero benefits
* from both race and role; thus genocide affects either.
*/

View File

@@ -2162,7 +2162,7 @@ trapeffect_poly_trap(
deltrap(trap); /* delete trap before polymorph */
newsym(u.ux, u.uy); /* get rid of trap symbol */
You_feel("a change coming over you.");
polyself(0);
polyself(POLY_NOFLAGS);
}
} else {
boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed);

View File

@@ -2572,7 +2572,7 @@ zapyourself(struct obj *obj, boolean ordinary)
case SPE_POLYMORPH:
if (!Unchanging) {
learn_it = TRUE;
polyself(0);
polyself(POLY_NOFLAGS);
}
break;