Unify polymorph traps
This commit is contained in:
80
src/trap.c
80
src/trap.c
@@ -28,7 +28,7 @@ static int FDECL(trapeffect_web, (struct monst *, struct trap *, unsigned));
|
|||||||
static int FDECL(trapeffect_statue_trap, (struct monst *, struct trap *, unsigned));
|
static int FDECL(trapeffect_statue_trap, (struct monst *, struct trap *, unsigned));
|
||||||
static int FDECL(trapeffect_magic_trap, (struct monst *, struct trap *, unsigned));
|
static int FDECL(trapeffect_magic_trap, (struct monst *, struct trap *, unsigned));
|
||||||
static int FDECL(trapeffect_anti_magic, (struct monst *, struct trap *, unsigned));
|
static int FDECL(trapeffect_anti_magic, (struct monst *, struct trap *, unsigned));
|
||||||
static void FDECL(trapeffect_poly_trap, (struct trap *, unsigned));
|
static int FDECL(trapeffect_poly_trap, (struct monst *, struct trap *, unsigned));
|
||||||
static void FDECL(trapeffect_landmine, (struct trap *, unsigned));
|
static void FDECL(trapeffect_landmine, (struct trap *, unsigned));
|
||||||
static void FDECL(trapeffect_rolling_boulder_trap, (struct trap *, unsigned));
|
static void FDECL(trapeffect_rolling_boulder_trap, (struct trap *, unsigned));
|
||||||
static void FDECL(trapeffect_magic_portal, (struct trap *, unsigned));
|
static void FDECL(trapeffect_magic_portal, (struct trap *, unsigned));
|
||||||
@@ -2047,38 +2047,52 @@ unsigned trflags;
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
trapeffect_poly_trap(trap, trflags)
|
trapeffect_poly_trap(mtmp, trap, trflags)
|
||||||
|
struct monst *mtmp;
|
||||||
struct trap *trap;
|
struct trap *trap;
|
||||||
unsigned trflags;
|
unsigned trflags;
|
||||||
{
|
{
|
||||||
boolean viasitting = (trflags & VIASITTING) != 0;
|
if (mtmp == &g.youmonst) {
|
||||||
int steed_article = ARTICLE_THE;
|
boolean viasitting = (trflags & VIASITTING) != 0;
|
||||||
char verbbuf[BUFSZ];
|
int steed_article = ARTICLE_THE;
|
||||||
|
char verbbuf[BUFSZ];
|
||||||
|
|
||||||
seetrap(trap);
|
seetrap(trap);
|
||||||
if (viasitting)
|
if (viasitting)
|
||||||
Strcpy(verbbuf, "trigger"); /* follows "You sit down." */
|
Strcpy(verbbuf, "trigger"); /* follows "You sit down." */
|
||||||
else if (u.usteed)
|
else if (u.usteed)
|
||||||
Sprintf(verbbuf, "lead %s onto",
|
Sprintf(verbbuf, "lead %s onto",
|
||||||
x_monnam(u.usteed, steed_article, (char *) 0,
|
x_monnam(u.usteed, steed_article, (char *) 0,
|
||||||
SUPPRESS_SADDLE, FALSE));
|
SUPPRESS_SADDLE, FALSE));
|
||||||
else
|
else
|
||||||
Sprintf(verbbuf, "%s onto",
|
Sprintf(verbbuf, "%s onto",
|
||||||
Levitation ? (const char *) "float"
|
Levitation ? (const char *) "float"
|
||||||
: locomotion(g.youmonst.data, "step"));
|
: locomotion(g.youmonst.data, "step"));
|
||||||
You("%s a polymorph trap!", verbbuf);
|
You("%s a polymorph trap!", verbbuf);
|
||||||
if (Antimagic || Unchanging) {
|
if (Antimagic || Unchanging) {
|
||||||
shieldeff(u.ux, u.uy);
|
shieldeff(u.ux, u.uy);
|
||||||
You_feel("momentarily different.");
|
You_feel("momentarily different.");
|
||||||
/* Trap did nothing; don't remove it --KAA */
|
/* Trap did nothing; don't remove it --KAA */
|
||||||
|
} else {
|
||||||
|
(void) steedintrap(trap, (struct obj *) 0);
|
||||||
|
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);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
(void) steedintrap(trap, (struct obj *) 0);
|
boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed);
|
||||||
deltrap(trap); /* delete trap before polymorph */
|
|
||||||
newsym(u.ux, u.uy); /* get rid of trap symbol */
|
if (resists_magm(mtmp)) {
|
||||||
You_feel("a change coming over you.");
|
shieldeff(mtmp->mx, mtmp->my);
|
||||||
polyself(0);
|
} else if (!resist(mtmp, WAND_CLASS, 0, NOTELL)) {
|
||||||
|
(void) newcham(mtmp, (struct permonst *) 0, FALSE, FALSE);
|
||||||
|
if (in_sight)
|
||||||
|
seetrap(trap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2303,7 +2317,7 @@ unsigned trflags;
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case POLY_TRAP:
|
case POLY_TRAP:
|
||||||
trapeffect_poly_trap(trap, trflags);
|
(void) trapeffect_poly_trap(&g.youmonst, trap, trflags);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LANDMINE:
|
case LANDMINE:
|
||||||
@@ -3052,15 +3066,7 @@ register struct monst *mtmp;
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case POLY_TRAP:
|
case POLY_TRAP:
|
||||||
if (resists_magm(mtmp)) {
|
return trapeffect_poly_trap(mtmp, trap, 0);
|
||||||
shieldeff(mtmp->mx, mtmp->my);
|
|
||||||
} else if (!resist(mtmp, WAND_CLASS, 0, NOTELL)) {
|
|
||||||
if (newcham(mtmp, (struct permonst *) 0, FALSE, FALSE))
|
|
||||||
/* we're done with mptr but keep it up to date */
|
|
||||||
mptr = mtmp->data;
|
|
||||||
if (in_sight)
|
|
||||||
seetrap(trap);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case ROLLING_BOULDER_TRAP:
|
case ROLLING_BOULDER_TRAP:
|
||||||
if (!is_flyer(mptr)) {
|
if (!is_flyer(mptr)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user