polyself changes (trunk only)
Several polymorph tweaks, most dealing with specifying form under
polymorph control or for wizard #polyself:
1) allow "were<critter>" and "human were<critter>" for your type of
<critter> when you're inflicted with lycanthropy; now you'll toggle
shape rather than be told "you cannot polymorph into that".
2) allow your own role; now you'll become a new man (or whatever race)
rather than get "you can't".
3) allow "human" to force a new man (or whatever) regardless of race.
No change for human characters, but elves, dwarves, and such can now
use either their own race or "human". (They never become humans.)
4) for wizard #polyself only, override the 20% chance of becoming a new
man instead of taking on the selected form. (This implicitly prevents
the annoying "your new form isn't healthy enough to survive" death
since your experience level won't drop below 1.)
5) remove a redundant drowning check in polyself(); it's already handled
in polymon() and polyman(for newman()) via spoteffects().
This also gets rid of an old use of 0 as not-a-valid-monster (not
responisble for any bugs though since giant ants aren't lycanthropes).
This commit is contained in:
@@ -2418,6 +2418,7 @@ E void FDECL(skill_init, (const struct def_skill *));
|
|||||||
/* ### were.c ### */
|
/* ### were.c ### */
|
||||||
|
|
||||||
E void FDECL(were_change, (struct monst *));
|
E void FDECL(were_change, (struct monst *));
|
||||||
|
E int FDECL(counter_were, (int));
|
||||||
E void FDECL(new_were, (struct monst *));
|
E void FDECL(new_were, (struct monst *));
|
||||||
E int FDECL(were_summon, (struct permonst *,BOOLEAN_P,int *,char *));
|
E int FDECL(were_summon, (struct permonst *,BOOLEAN_P,int *,char *));
|
||||||
E void NDECL(you_were);
|
E void NDECL(you_were);
|
||||||
|
|||||||
+34
-25
@@ -235,19 +235,19 @@ polyself(psflags)
|
|||||||
int psflags;
|
int psflags;
|
||||||
{
|
{
|
||||||
char buf[BUFSZ];
|
char buf[BUFSZ];
|
||||||
int old_light, new_light;
|
int old_light, new_light, mntmp, tries;
|
||||||
int mntmp = NON_PM;
|
boolean forcecontrol = (psflags == 1),
|
||||||
int tries=0;
|
monsterpoly = (psflags == 2),
|
||||||
boolean forcecontrol = (psflags == 1);
|
draconian = (uarm && Is_dragon_armor(uarm)),
|
||||||
boolean monsterpoly = (psflags == 2);
|
iswere = (u.ulycn >= LOW_PM || is_were(youmonst.data)),
|
||||||
boolean draconian = (uarm &&
|
isvamp = (youmonst.data->mlet == S_VAMPIRE);
|
||||||
uarm->otyp >= GRAY_DRAGON_SCALE_MAIL &&
|
|
||||||
uarm->otyp <= YELLOW_DRAGON_SCALES);
|
|
||||||
boolean iswere = (u.ulycn >= LOW_PM || is_were(youmonst.data));
|
|
||||||
boolean isvamp = (youmonst.data->mlet == S_VAMPIRE);
|
|
||||||
boolean was_floating = (Levitation || Flying);
|
|
||||||
|
|
||||||
if(!Polymorph_control && !forcecontrol && !draconian && !iswere && !isvamp) {
|
if (Unchanging) {
|
||||||
|
pline("You fail to transform!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!Polymorph_control && !forcecontrol &&
|
||||||
|
!draconian && !iswere && !isvamp) {
|
||||||
if (rn2(20) > ACURR(A_CON)) {
|
if (rn2(20) > ACURR(A_CON)) {
|
||||||
You(shudder_for_moment);
|
You(shudder_for_moment);
|
||||||
losehp(rnd(30), "system shock", KILLED_BY_AN);
|
losehp(rnd(30), "system shock", KILLED_BY_AN);
|
||||||
@@ -256,18 +256,27 @@ int psflags;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
old_light = Upolyd ? emits_light(youmonst.data) : 0;
|
old_light = Upolyd ? emits_light(youmonst.data) : 0;
|
||||||
|
mntmp = NON_PM;
|
||||||
|
|
||||||
if ((Polymorph_control || forcecontrol) && !monsterpoly) {
|
if ((Polymorph_control || forcecontrol) && !monsterpoly) {
|
||||||
|
tries = 0;
|
||||||
do {
|
do {
|
||||||
getlin("Become what kind of monster? [type the name]",
|
getlin("Become what kind of monster? [type the name]",
|
||||||
buf);
|
buf);
|
||||||
mntmp = name_to_mon(buf);
|
mntmp = name_to_mon(buf);
|
||||||
if (mntmp < LOW_PM)
|
if (mntmp < LOW_PM)
|
||||||
pline("I've never heard of such monsters.");
|
pline("I've never heard of such monsters.");
|
||||||
|
else if (u.ulycn && (mntmp == u.ulycn ||
|
||||||
|
mntmp == counter_were(u.ulycn)))
|
||||||
|
goto do_shift;
|
||||||
/* Note: humans are illegal as monsters, but an
|
/* Note: humans are illegal as monsters, but an
|
||||||
* illegal monster forces newman(), which is what we
|
* illegal monster forces newman(), which is what we
|
||||||
* want if they specified a human.... */
|
* want if they specified a human.... */
|
||||||
else if (!polyok(&mons[mntmp]) && !your_race(&mons[mntmp]))
|
else if (!polyok(&mons[mntmp]) &&
|
||||||
|
!(mntmp == PM_HUMAN ||
|
||||||
|
your_race(&mons[mntmp]) ||
|
||||||
|
mntmp == urole.malenum ||
|
||||||
|
mntmp == urole.femalenum))
|
||||||
You("cannot polymorph into that.");
|
You("cannot polymorph into that.");
|
||||||
else break;
|
else break;
|
||||||
} while(++tries < 5);
|
} while(++tries < 5);
|
||||||
@@ -279,7 +288,7 @@ int psflags;
|
|||||||
} else if (draconian || iswere || isvamp) {
|
} else if (draconian || iswere || isvamp) {
|
||||||
/* special changes that don't require polyok() */
|
/* special changes that don't require polyok() */
|
||||||
if (draconian) {
|
if (draconian) {
|
||||||
do_merge:
|
do_merge:
|
||||||
mntmp = armor_to_dragon(uarm->otyp);
|
mntmp = armor_to_dragon(uarm->otyp);
|
||||||
if (!(mvitals[mntmp].mvflags & G_GENOD)) {
|
if (!(mvitals[mntmp].mvflags & G_GENOD)) {
|
||||||
/* allow G_EXTINCT */
|
/* allow G_EXTINCT */
|
||||||
@@ -290,6 +299,7 @@ int psflags;
|
|||||||
uskin->owornmask |= I_SPECIAL;
|
uskin->owornmask |= I_SPECIAL;
|
||||||
}
|
}
|
||||||
} else if (iswere) {
|
} else if (iswere) {
|
||||||
|
do_shift:
|
||||||
if (is_were(youmonst.data))
|
if (is_were(youmonst.data))
|
||||||
mntmp = PM_HUMAN; /* Illegal; force newman() */
|
mntmp = PM_HUMAN; /* Illegal; force newman() */
|
||||||
else
|
else
|
||||||
@@ -323,33 +333,32 @@ int psflags;
|
|||||||
do {
|
do {
|
||||||
/* randomly pick an "ordinary" monster */
|
/* randomly pick an "ordinary" monster */
|
||||||
mntmp = rn1(SPECIAL_PM - LOW_PM, LOW_PM);
|
mntmp = rn1(SPECIAL_PM - LOW_PM, LOW_PM);
|
||||||
} while((!polyok(&mons[mntmp]) || is_placeholder(&mons[mntmp]))
|
if (polyok(&mons[mntmp]) &&
|
||||||
&& tries++ < 200);
|
!is_placeholder(&mons[mntmp])) break;
|
||||||
|
} while (++tries < 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The below polyok() fails either if everything is genocided, or if
|
/* The below polyok() fails either if everything is genocided, or if
|
||||||
* we deliberately chose something illegal to force newman().
|
* we deliberately chose something illegal to force newman().
|
||||||
*/
|
*/
|
||||||
if (!polyok(&mons[mntmp]) || !rn2(5) || your_race(&mons[mntmp]))
|
if (!polyok(&mons[mntmp]) ||
|
||||||
|
(!forcecontrol && !rn2(5)) || your_race(&mons[mntmp])) {
|
||||||
newman();
|
newman();
|
||||||
else if(!polymon(mntmp)) return;
|
} else if (!polymon(mntmp)) {
|
||||||
|
return; /* failed to change */
|
||||||
if (!uarmg) selftouch("No longer petrify-resistant, you");
|
}
|
||||||
|
|
||||||
made_change:
|
made_change:
|
||||||
|
if (!uarmg) selftouch("No longer petrify-resistant, you");
|
||||||
new_light = Upolyd ? emits_light(youmonst.data) : 0;
|
new_light = Upolyd ? emits_light(youmonst.data) : 0;
|
||||||
|
if (new_light == 1) ++new_light; /* otherwise it's undetectable */
|
||||||
if (old_light != new_light) {
|
if (old_light != new_light) {
|
||||||
if (old_light)
|
if (old_light)
|
||||||
del_light_source(LS_MONSTER, (genericptr_t)&youmonst);
|
del_light_source(LS_MONSTER, (genericptr_t)&youmonst);
|
||||||
if (new_light == 1) ++new_light; /* otherwise it's undetectable */
|
|
||||||
if (new_light)
|
if (new_light)
|
||||||
new_light_source(u.ux, u.uy, new_light,
|
new_light_source(u.ux, u.uy, new_light,
|
||||||
LS_MONSTER, (genericptr_t)&youmonst);
|
LS_MONSTER, (genericptr_t)&youmonst);
|
||||||
}
|
}
|
||||||
if (is_pool(u.ux,u.uy) && was_floating && !(Levitation || Flying) &&
|
|
||||||
!breathless(youmonst.data) && !amphibious(youmonst.data) &&
|
|
||||||
!Swimming)
|
|
||||||
(void) drown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (try to) make a mntmp monster out of the player */
|
/* (try to) make a mntmp monster out of the player */
|
||||||
|
|||||||
+4
-6
@@ -1,4 +1,4 @@
|
|||||||
/* SCCS Id: @(#)were.c 3.5 2002/11/07 */
|
/* SCCS Id: @(#)were.c 3.5 2006/05/27 */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -33,9 +33,7 @@ register struct monst *mon;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC_DCL int FDECL(counter_were,(int));
|
int
|
||||||
|
|
||||||
STATIC_OVL int
|
|
||||||
counter_were(pm)
|
counter_were(pm)
|
||||||
int pm;
|
int pm;
|
||||||
{
|
{
|
||||||
@@ -46,7 +44,7 @@ int pm;
|
|||||||
case PM_HUMAN_WEREJACKAL: return(PM_WEREJACKAL);
|
case PM_HUMAN_WEREJACKAL: return(PM_WEREJACKAL);
|
||||||
case PM_WERERAT: return(PM_HUMAN_WERERAT);
|
case PM_WERERAT: return(PM_HUMAN_WERERAT);
|
||||||
case PM_HUMAN_WERERAT: return(PM_WERERAT);
|
case PM_HUMAN_WERERAT: return(PM_WERERAT);
|
||||||
default: return(0);
|
default: return NON_PM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,7 +55,7 @@ register struct monst *mon;
|
|||||||
register int pm;
|
register int pm;
|
||||||
|
|
||||||
pm = counter_were(monsndx(mon->data));
|
pm = counter_were(monsndx(mon->data));
|
||||||
if(!pm) {
|
if (pm < LOW_PM) {
|
||||||
impossible("unknown lycanthrope %s.", mon->data->mname);
|
impossible("unknown lycanthrope %s.", mon->data->mname);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user