Split trap effects out of dotrap

This commit is contained in:
Pasi Kallinen
2020-12-10 19:04:29 +02:00
parent 68b69380fb
commit b5cfd8333f
+339 -130
View File
@@ -12,6 +12,26 @@ static boolean FDECL(keep_saddle_with_steedcorpse, (unsigned, struct obj *,
static boolean FDECL(mu_maybe_destroy_web, (struct monst *, BOOLEAN_P, static boolean FDECL(mu_maybe_destroy_web, (struct monst *, BOOLEAN_P,
struct trap *)); struct trap *));
static struct obj *FDECL(t_missile, (int, struct trap *)); static struct obj *FDECL(t_missile, (int, struct trap *));
static void FDECL(trapeffect_arrow_trap, (struct trap *, unsigned));
static void FDECL(trapeffect_dart_trap, (struct trap *, unsigned));
static void FDECL(trapeffect_rocktrap, (struct trap *, unsigned));
static void FDECL(trapeffect_sqky_board, (struct trap *, unsigned));
static void FDECL(trapeffect_bear_trap, (struct trap *, unsigned));
static void FDECL(trapeffect_slp_gas_trap, (struct trap *, unsigned));
static void FDECL(trapeffect_rust_trap, (struct trap *, unsigned));
static void FDECL(trapeffect_fire_trap, (struct trap *, unsigned));
static void FDECL(trapeffect_pit, (struct trap *, unsigned));
static void FDECL(trapeffect_hole, (struct trap *, unsigned));
static void FDECL(trapeffect_telep_trap, (struct trap *, unsigned));
static void FDECL(trapeffect_level_telep, (struct trap *, unsigned));
static void FDECL(trapeffect_web, (struct trap *, unsigned));
static void FDECL(trapeffect_statue_trap, (struct trap *, unsigned));
static void FDECL(trapeffect_magic_trap, (struct trap *, unsigned));
static void FDECL(trapeffect_anti_magic, (struct trap *, unsigned));
static void FDECL(trapeffect_poly_trap, (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_magic_portal, (struct trap *, unsigned));
static char *FDECL(trapnote, (struct trap *, BOOLEAN_P)); static char *FDECL(trapnote, (struct trap *, BOOLEAN_P));
static int FDECL(steedintrap, (struct trap *, struct obj *)); static int FDECL(steedintrap, (struct trap *, struct obj *));
static void FDECL(launch_drop_spot, (struct obj *, XCHAR_P, XCHAR_P)); static void FDECL(launch_drop_spot, (struct obj *, XCHAR_P, XCHAR_P));
@@ -902,82 +922,18 @@ boolean msg;
} }
} }
void static void
dotrap(trap, trflags) trapeffect_arrow_trap(trap, trflags)
register struct trap *trap; struct trap *trap;
unsigned trflags; unsigned trflags;
{ {
register int ttype = trap->ttyp;
struct obj *otmp; struct obj *otmp;
boolean already_seen = trap->tseen,
forcetrap = ((trflags & FORCETRAP) != 0
|| (trflags & FAILEDUNTRAP) != 0),
webmsgok = (trflags & NOWEBMSG) == 0,
forcebungle = (trflags & FORCEBUNGLE) != 0,
plunged = (trflags & TOOKPLUNGE) != 0,
viasitting = (trflags & VIASITTING) != 0,
conj_pit = conjoined_pits(trap, t_at(u.ux0, u.uy0), TRUE),
adj_pit = adj_nonconjoined_pit(trap);
int oldumort;
int steed_article = ARTICLE_THE;
nomul(0);
/* KMH -- You can't escape the Sokoban level traps */
if (Sokoban && (is_pit(ttype) || is_hole(ttype))) {
/* The "air currents" message is still appropriate -- even when
* the hero isn't flying or levitating -- because it conveys the
* reason why the player cannot escape the trap with a dexterity
* check, clinging to the ceiling, etc.
*/
pline("Air currents pull you down into %s %s!",
a_your[trap->madeby_u],
trapname(ttype, TRUE)); /* do force "pit" while hallucinating */
/* then proceed to normal trap effect */
} else if (already_seen && !forcetrap) {
if ((Levitation || (Flying && !plunged))
&& (is_pit(ttype) || ttype == HOLE || ttype == BEAR_TRAP)) {
You("%s over %s %s.", Levitation ? "float" : "fly",
a_your[trap->madeby_u],
trapname(ttype, FALSE));
return;
}
if (!Fumbling && ttype != MAGIC_PORTAL && ttype != VIBRATING_SQUARE
&& ttype != ANTI_MAGIC && !forcebungle && !plunged
&& !conj_pit && !adj_pit
&& (!rn2(5) || (is_pit(ttype)
&& is_clinger(g.youmonst.data)))) {
You("escape %s %s.", (ttype == ARROW_TRAP && !trap->madeby_u)
? "an"
: a_your[trap->madeby_u],
trapname(ttype, FALSE));
return;
}
}
if (u.usteed) {
u.usteed->mtrapseen |= (1 << (ttype - 1));
/* suppress article in various steed messages when using its
name (which won't occur when hallucinating) */
if (has_mname(u.usteed) && !Hallucination)
steed_article = ARTICLE_NONE;
}
/*
* Note:
* Most references to trap types here don't use trapname() for
* hallucination. This could be considered to be a bug but doing
* that would hide the actual trap situation from the player which
* would be somewhat harsh for what's usually a minor impairment.
*/
switch (ttype) {
case ARROW_TRAP:
if (trap->once && trap->tseen && !rn2(15)) { if (trap->once && trap->tseen && !rn2(15)) {
You_hear("a loud click!"); You_hear("a loud click!");
deltrap(trap); deltrap(trap);
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
break; return;
} }
trap->once = 1; trap->once = 1;
seetrap(trap); seetrap(trap);
@@ -995,14 +951,21 @@ unsigned trflags;
stackobj(otmp); stackobj(otmp);
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
} }
break; }
static void
trapeffect_dart_trap(trap, trflags)
struct trap *trap;
unsigned trflags;
{
struct obj *otmp;
int oldumort = u.umortality;
case DART_TRAP:
if (trap->once && trap->tseen && !rn2(15)) { if (trap->once && trap->tseen && !rn2(15)) {
You_hear("a soft click."); You_hear("a soft click.");
deltrap(trap); deltrap(trap);
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
break; return;
} }
trap->once = 1; trap->once = 1;
seetrap(trap); seetrap(trap);
@@ -1010,7 +973,6 @@ unsigned trflags;
otmp = t_missile(DART, trap); otmp = t_missile(DART, trap);
if (!rn2(6)) if (!rn2(6))
otmp->opoisoned = 1; otmp->opoisoned = 1;
oldumort = u.umortality;
if (u.usteed && !rn2(2) && steedintrap(trap, otmp)) { if (u.usteed && !rn2(2) && steedintrap(trap, otmp)) {
; /* nothing */ ; /* nothing */
} else if (thitu(7, dmgval(otmp, &g.youmonst), &otmp, "little dart")) { } else if (thitu(7, dmgval(otmp, &g.youmonst), &otmp, "little dart")) {
@@ -1029,9 +991,13 @@ unsigned trflags;
stackobj(otmp); stackobj(otmp);
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
} }
break; }
case ROCKTRAP: static void
trapeffect_rocktrap(trap, trflags)
struct trap *trap;
unsigned trflags;
{
if (trap->once && trap->tseen && !rn2(15)) { if (trap->once && trap->tseen && !rn2(15)) {
pline("A trap door in %s opens, but nothing falls out!", pline("A trap door in %s opens, but nothing falls out!",
the(ceiling(u.ux, u.uy))); the(ceiling(u.ux, u.uy)));
@@ -1039,6 +1005,7 @@ unsigned trflags;
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
} else { } else {
int dmg = d(2, 6); /* should be std ROCK dmg? */ int dmg = d(2, 6); /* should be std ROCK dmg? */
struct obj *otmp;
trap->once = 1; trap->once = 1;
feeltrap(trap); feeltrap(trap);
@@ -1063,9 +1030,16 @@ unsigned trflags;
losehp(Maybe_Half_Phys(dmg), "falling rock", KILLED_BY_AN); losehp(Maybe_Half_Phys(dmg), "falling rock", KILLED_BY_AN);
exercise(A_STR, FALSE); exercise(A_STR, FALSE);
} }
break; }
static void
trapeffect_sqky_board(trap, trflags)
struct trap *trap;
unsigned trflags;
{
boolean forcetrap = ((trflags & FORCETRAP) != 0
|| (trflags & FAILEDUNTRAP) != 0);
case SQKY_BOARD: /* stepped on a squeaky board */
if ((Levitation || Flying) && !forcetrap) { if ((Levitation || Flying) && !forcetrap) {
if (!Blind) { if (!Blind) {
seetrap(trap); seetrap(trap);
@@ -1081,24 +1055,31 @@ unsigned trflags;
Deaf ? "" : trapnote(trap, 0), Deaf ? "" : " loudly"); Deaf ? "" : trapnote(trap, 0), Deaf ? "" : " loudly");
wake_nearby(); wake_nearby();
} }
break; }
static void
trapeffect_bear_trap(trap, trflags)
struct trap *trap;
unsigned trflags;
{
boolean forcetrap = ((trflags & FORCETRAP) != 0
|| (trflags & FAILEDUNTRAP) != 0);
case BEAR_TRAP: {
int dmg = d(2, 4); int dmg = d(2, 4);
if ((Levitation || Flying) && !forcetrap) if ((Levitation || Flying) && !forcetrap)
break; return;
feeltrap(trap); feeltrap(trap);
if (amorphous(g.youmonst.data) || is_whirly(g.youmonst.data) if (amorphous(g.youmonst.data) || is_whirly(g.youmonst.data)
|| unsolid(g.youmonst.data)) { || unsolid(g.youmonst.data)) {
pline("%s bear trap closes harmlessly through you.", pline("%s bear trap closes harmlessly through you.",
A_Your[trap->madeby_u]); A_Your[trap->madeby_u]);
break; return;
} }
if (!u.usteed && g.youmonst.data->msize <= MZ_SMALL) { if (!u.usteed && g.youmonst.data->msize <= MZ_SMALL) {
pline("%s bear trap closes harmlessly over you.", pline("%s bear trap closes harmlessly over you.",
A_Your[trap->madeby_u]); A_Your[trap->madeby_u]);
break; return;
} }
set_utrap((unsigned) rn1(4, 4), TT_BEARTRAP); set_utrap((unsigned) rn1(4, 4), TT_BEARTRAP);
if (u.usteed) { if (u.usteed) {
@@ -1115,10 +1096,13 @@ unsigned trflags;
losehp(Maybe_Half_Phys(dmg), "bear trap", KILLED_BY_AN); losehp(Maybe_Half_Phys(dmg), "bear trap", KILLED_BY_AN);
} }
exercise(A_DEX, FALSE); exercise(A_DEX, FALSE);
break; }
}
case SLP_GAS_TRAP: static void
trapeffect_slp_gas_trap(trap, trflags)
struct trap *trap;
unsigned trflags;
{
seetrap(trap); seetrap(trap);
if (Sleep_resistance || breathless(g.youmonst.data)) { if (Sleep_resistance || breathless(g.youmonst.data)) {
You("are enveloped in a cloud of gas!"); You("are enveloped in a cloud of gas!");
@@ -1127,9 +1111,15 @@ unsigned trflags;
fall_asleep(-rnd(25), TRUE); fall_asleep(-rnd(25), TRUE);
} }
(void) steedintrap(trap, (struct obj *) 0); (void) steedintrap(trap, (struct obj *) 0);
break; }
static void
trapeffect_rust_trap(trap, trflags)
struct trap *trap;
unsigned trflags;
{
struct obj *otmp;
case RUST_TRAP:
seetrap(trap); seetrap(trap);
/* Unlike monsters, traps cannot aim their rust attacks at /* Unlike monsters, traps cannot aim their rust attacks at
@@ -1148,7 +1138,7 @@ unsigned trflags;
break; break;
if (u.twoweap || (uwep && bimanual(uwep))) if (u.twoweap || (uwep && bimanual(uwep)))
(void) water_damage(u.twoweap ? uswapwep : uwep, 0, TRUE); (void) water_damage(u.twoweap ? uswapwep : uwep, 0, TRUE);
glovecheck: glovecheck:
(void) water_damage(uarmg, gloves_simple_name(uarmg), TRUE); (void) water_damage(uarmg, gloves_simple_name(uarmg), TRUE);
break; break;
case 2: case 2:
@@ -1180,19 +1170,32 @@ unsigned trflags;
} else if (u.umonnum == PM_GREMLIN && rn2(3)) { } else if (u.umonnum == PM_GREMLIN && rn2(3)) {
(void) split_mon(&g.youmonst, (struct monst *) 0); (void) split_mon(&g.youmonst, (struct monst *) 0);
} }
}
break; static void
trapeffect_fire_trap(trap, trflags)
case FIRE_TRAP: struct trap *trap;
unsigned trflags;
{
seetrap(trap); seetrap(trap);
dofiretrap((struct obj *) 0); dofiretrap((struct obj *) 0);
break; }
static void
trapeffect_pit(trap, trflags)
struct trap *trap;
unsigned trflags;
{
int ttype = trap->ttyp;
boolean plunged = (trflags & TOOKPLUNGE) != 0;
boolean conj_pit = conjoined_pits(trap, t_at(u.ux0, u.uy0), TRUE);
boolean adj_pit = adj_nonconjoined_pit(trap);
int steed_article = ARTICLE_THE;
int oldumort;
case PIT:
case SPIKED_PIT:
/* KMH -- You can't escape the Sokoban level traps */ /* KMH -- You can't escape the Sokoban level traps */
if (!Sokoban && (Levitation || (Flying && !plunged))) if (!Sokoban && (Levitation || (Flying && !plunged)))
break; return;
feeltrap(trap); feeltrap(trap);
if (!Sokoban && is_clinger(g.youmonst.data) && !plunged) { if (!Sokoban && is_clinger(g.youmonst.data) && !plunged) {
if (trap->tseen) { if (trap->tseen) {
@@ -1203,7 +1206,7 @@ unsigned trflags;
ttype == SPIKED_PIT ? "full of spikes " : ""); ttype == SPIKED_PIT ? "full of spikes " : "");
You("don't fall in!"); You("don't fall in!");
} }
break; return;
} }
if (!Sokoban) { if (!Sokoban) {
char verbbuf[BUFSZ]; char verbbuf[BUFSZ];
@@ -1299,38 +1302,59 @@ unsigned trflags;
exercise(A_STR, FALSE); exercise(A_STR, FALSE);
exercise(A_DEX, FALSE); exercise(A_DEX, FALSE);
} }
break; }
case HOLE: static void
case TRAPDOOR: trapeffect_hole(trap, trflags)
struct trap *trap;
unsigned trflags;
{
if (!Can_fall_thru(&u.uz)) { if (!Can_fall_thru(&u.uz)) {
seetrap(trap); /* normally done in fall_through */ seetrap(trap); /* normally done in fall_through */
impossible("dotrap: %ss cannot exist on this level.", impossible("dotrap: %ss cannot exist on this level.",
trapname(ttype, TRUE)); trapname(trap->ttyp, TRUE));
break; /* don't activate it after all */ return; /* don't activate it after all */
} }
fall_through(TRUE, (trflags & TOOKPLUNGE)); fall_through(TRUE, (trflags & TOOKPLUNGE));
break; }
case TELEP_TRAP: static void
trapeffect_telep_trap(trap, trflags)
struct trap *trap;
unsigned trflags;
{
seetrap(trap); seetrap(trap);
tele_trap(trap); tele_trap(trap);
break; }
case LEVEL_TELEP: static void
trapeffect_level_telep(trap, trflags)
struct trap *trap;
unsigned trflags;
{
seetrap(trap); seetrap(trap);
level_tele_trap(trap, trflags); level_tele_trap(trap, trflags);
break; }
static void
trapeffect_web(trap, trflags)
struct trap *trap;
unsigned trflags;
{
boolean webmsgok = (trflags & NOWEBMSG) == 0;
boolean forcetrap = ((trflags & FORCETRAP) != 0
|| (trflags & FAILEDUNTRAP) != 0);
boolean viasitting = (trflags & VIASITTING) != 0;
int steed_article = ARTICLE_THE;
case WEB: /* Our luckless player has stumbled into a web. */
feeltrap(trap); feeltrap(trap);
if (mu_maybe_destroy_web(&g.youmonst, webmsgok, trap)) if (mu_maybe_destroy_web(&g.youmonst, webmsgok, trap))
break; return;
if (webmaker(g.youmonst.data)) { if (webmaker(g.youmonst.data)) {
if (webmsgok) if (webmsgok)
pline(trap->madeby_u ? "You take a walk on your web." pline(trap->madeby_u ? "You take a walk on your web."
: "There is a spider web here."); : "There is a spider web here.");
break; return;
} }
if (webmsgok) { if (webmsgok) {
char verbbuf[BUFSZ]; char verbbuf[BUFSZ];
@@ -1377,7 +1401,7 @@ unsigned trflags;
str = 17; str = 17;
} else { } else {
reset_utrap(FALSE); reset_utrap(FALSE);
break; return;
} }
webmsgok = FALSE; /* mintrap printed the messages */ webmsgok = FALSE; /* mintrap printed the messages */
@@ -1405,13 +1429,21 @@ unsigned trflags;
} }
set_utrap((unsigned) tim, TT_WEB); set_utrap((unsigned) tim, TT_WEB);
} }
break; }
case STATUE_TRAP: static void
trapeffect_statue_trap(trap, trflags)
struct trap *trap;
unsigned trflags;
{
(void) activate_statue_trap(trap, u.ux, u.uy, FALSE); (void) activate_statue_trap(trap, u.ux, u.uy, FALSE);
break; }
case MAGIC_TRAP: /* A magic trap. */ static void
trapeffect_magic_trap(trap, trflags)
struct trap *trap;
unsigned trflags;
{
seetrap(trap); seetrap(trap);
if (!rn2(30)) { if (!rn2(30)) {
deltrap(trap); deltrap(trap);
@@ -1420,14 +1452,18 @@ unsigned trflags;
losehp(rnd(10), "magical explosion", KILLED_BY_AN); losehp(rnd(10), "magical explosion", KILLED_BY_AN);
Your("body absorbs some of the magical energy!"); Your("body absorbs some of the magical energy!");
u.uen = (u.uenmax += 2); u.uen = (u.uenmax += 2);
break; return;
} else { } else {
domagictrap(); domagictrap();
} }
(void) steedintrap(trap, (struct obj *) 0); (void) steedintrap(trap, (struct obj *) 0);
break; }
case ANTI_MAGIC: static void
trapeffect_anti_magic(trap, trflags)
struct trap *trap;
unsigned trflags;
{
seetrap(trap); seetrap(trap);
/* hero without magic resistance loses spell energy, /* hero without magic resistance loses spell energy,
hero with magic resistance takes damage instead; hero with magic resistance takes damage instead;
@@ -1435,6 +1471,7 @@ unsigned trflags;
if (!Antimagic) { if (!Antimagic) {
drain_en(rnd(u.ulevel) + 1); drain_en(rnd(u.ulevel) + 1);
} else { } else {
struct obj *otmp;
int dmgval2 = rnd(4), hp = Upolyd ? u.mh : u.uhp; int dmgval2 = rnd(4), hp = Upolyd ? u.mh : u.uhp;
/* Half_XXX_damage has opposite its usual effect (approx) /* Half_XXX_damage has opposite its usual effect (approx)
@@ -1462,9 +1499,15 @@ unsigned trflags;
/* opposite of magical explosion */ /* opposite of magical explosion */
losehp(dmgval2, "anti-magic implosion", KILLED_BY_AN); losehp(dmgval2, "anti-magic implosion", KILLED_BY_AN);
} }
break; }
case POLY_TRAP: { static void
trapeffect_poly_trap(trap, trflags)
struct trap *trap;
unsigned trflags;
{
boolean viasitting = (trflags & VIASITTING) != 0;
int steed_article = ARTICLE_THE;
char verbbuf[BUFSZ]; char verbbuf[BUFSZ];
seetrap(trap); seetrap(trap);
@@ -1490,21 +1533,29 @@ unsigned trflags;
You_feel("a change coming over you."); You_feel("a change coming over you.");
polyself(0); polyself(0);
} }
break; }
}
case LANDMINE: { static void
trapeffect_landmine(trap, trflags)
struct trap *trap;
unsigned trflags;
{
boolean already_seen = trap->tseen;
boolean forcetrap = ((trflags & FORCETRAP) != 0
|| (trflags & FAILEDUNTRAP) != 0);
boolean forcebungle = (trflags & FORCEBUNGLE) != 0;
unsigned steed_mid = 0; unsigned steed_mid = 0;
struct obj *saddle = 0; struct obj *saddle = 0;
if ((Levitation || Flying) && !forcetrap) { if ((Levitation || Flying) && !forcetrap) {
if (!already_seen && rn2(3)) if (!already_seen && rn2(3))
break; return;
feeltrap(trap); feeltrap(trap);
pline("%s %s in a pile of soil below you.", pline("%s %s in a pile of soil below you.",
already_seen ? "There is" : "You discover", already_seen ? "There is" : "You discover",
trap->madeby_u ? "the trigger of your mine" : "a trigger"); trap->madeby_u ? "the trigger of your mine" : "a trigger");
if (already_seen && rn2(3)) if (already_seen && rn2(3))
break; return;
pline("KAABLAMM!!! %s %s%s off!", pline("KAABLAMM!!! %s %s%s off!",
forcebungle ? "Your inept attempt sets" forcebungle ? "Your inept attempt sets"
: "The air currents set", : "The air currents set",
@@ -1518,7 +1569,7 @@ unsigned trflags;
static boolean recursive_mine = FALSE; static boolean recursive_mine = FALSE;
if (recursive_mine) if (recursive_mine)
break; return;
feeltrap(trap); feeltrap(trap);
pline("KAABLAMM!!! You triggered %s land mine!", pline("KAABLAMM!!! You triggered %s land mine!",
a_your[trap->madeby_u]); a_your[trap->madeby_u]);
@@ -1541,10 +1592,13 @@ unsigned trflags;
if ((trap = t_at(u.ux, u.uy)) != 0) if ((trap = t_at(u.ux, u.uy)) != 0)
dotrap(trap, RECURSIVETRAP); dotrap(trap, RECURSIVETRAP);
fill_pit(u.ux, u.uy); fill_pit(u.ux, u.uy);
break; }
}
case ROLLING_BOULDER_TRAP: { static void
trapeffect_rolling_boulder_trap(trap, trflags)
struct trap *trap;
unsigned trflags;
{
int style = ROLL | (trap->tseen ? LAUNCH_KNOWN : 0); int style = ROLL | (trap->tseen ? LAUNCH_KNOWN : 0);
feeltrap(trap); feeltrap(trap);
@@ -1555,12 +1609,167 @@ unsigned trflags;
newsym(u.ux, u.uy); /* get rid of trap symbol */ newsym(u.ux, u.uy); /* get rid of trap symbol */
pline("Fortunately for you, no boulder was released."); pline("Fortunately for you, no boulder was released.");
} }
break; }
}
case MAGIC_PORTAL: static void
trapeffect_magic_portal(trap, trflags)
struct trap *trap;
unsigned trflags;
{
feeltrap(trap); feeltrap(trap);
domagicportal(trap); domagicportal(trap);
}
void
dotrap(trap, trflags)
register struct trap *trap;
unsigned trflags;
{
register int ttype = trap->ttyp;
struct obj *otmp;
boolean already_seen = trap->tseen,
forcetrap = ((trflags & FORCETRAP) != 0
|| (trflags & FAILEDUNTRAP) != 0),
webmsgok = (trflags & NOWEBMSG) == 0,
forcebungle = (trflags & FORCEBUNGLE) != 0,
plunged = (trflags & TOOKPLUNGE) != 0,
viasitting = (trflags & VIASITTING) != 0,
conj_pit = conjoined_pits(trap, t_at(u.ux0, u.uy0), TRUE),
adj_pit = adj_nonconjoined_pit(trap);
int oldumort;
int steed_article = ARTICLE_THE;
nomul(0);
/* KMH -- You can't escape the Sokoban level traps */
if (Sokoban && (is_pit(ttype) || is_hole(ttype))) {
/* The "air currents" message is still appropriate -- even when
* the hero isn't flying or levitating -- because it conveys the
* reason why the player cannot escape the trap with a dexterity
* check, clinging to the ceiling, etc.
*/
pline("Air currents pull you down into %s %s!",
a_your[trap->madeby_u],
trapname(ttype, TRUE)); /* do force "pit" while hallucinating */
/* then proceed to normal trap effect */
} else if (already_seen && !forcetrap) {
if ((Levitation || (Flying && !plunged))
&& (is_pit(ttype) || ttype == HOLE || ttype == BEAR_TRAP)) {
You("%s over %s %s.", Levitation ? "float" : "fly",
a_your[trap->madeby_u],
trapname(ttype, FALSE));
return;
}
if (!Fumbling && ttype != MAGIC_PORTAL && ttype != VIBRATING_SQUARE
&& ttype != ANTI_MAGIC && !forcebungle && !plunged
&& !conj_pit && !adj_pit
&& (!rn2(5) || (is_pit(ttype)
&& is_clinger(g.youmonst.data)))) {
You("escape %s %s.", (ttype == ARROW_TRAP && !trap->madeby_u)
? "an"
: a_your[trap->madeby_u],
trapname(ttype, FALSE));
return;
}
}
if (u.usteed) {
u.usteed->mtrapseen |= (1 << (ttype - 1));
/* suppress article in various steed messages when using its
name (which won't occur when hallucinating) */
if (has_mname(u.usteed) && !Hallucination)
steed_article = ARTICLE_NONE;
}
/*
* Note:
* Most references to trap types here don't use trapname() for
* hallucination. This could be considered to be a bug but doing
* that would hide the actual trap situation from the player which
* would be somewhat harsh for what's usually a minor impairment.
*/
switch (ttype) {
case ARROW_TRAP:
trapeffect_arrow_trap(trap, trflags);
break;
case DART_TRAP:
trapeffect_dart_trap(trap, trflags);
break;
case ROCKTRAP:
trapeffect_rocktrap(trap, trflags);
break;
case SQKY_BOARD: /* stepped on a squeaky board */
trapeffect_sqky_board(trap, trflags);
break;
case BEAR_TRAP:
trapeffect_bear_trap(trap, trflags);
break;
case SLP_GAS_TRAP:
trapeffect_slp_gas_trap(trap, trflags);
break;
case RUST_TRAP:
trapeffect_rust_trap(trap, trflags);
break;
case FIRE_TRAP:
trapeffect_fire_trap(trap, trflags);
break;
case PIT:
case SPIKED_PIT:
trapeffect_pit(trap, trflags);
break;
case HOLE:
case TRAPDOOR:
trapeffect_hole(trap, trflags);
break;
case TELEP_TRAP:
trapeffect_telep_trap(trap, trflags);
break;
case LEVEL_TELEP:
trapeffect_level_telep(trap, trflags);
break;
case WEB: /* Our luckless player has stumbled into a web. */
trapeffect_web(trap, trflags);
break;
case STATUE_TRAP:
trapeffect_statue_trap(trap, trflags);
break;
case MAGIC_TRAP: /* A magic trap. */
trapeffect_magic_trap(trap, trflags);
break;
case ANTI_MAGIC:
trapeffect_anti_magic(trap, trflags);
break;
case POLY_TRAP:
trapeffect_poly_trap(trap, trflags);
break;
case LANDMINE:
trapeffect_landmine(trap, trflags);
break;
case ROLLING_BOULDER_TRAP:
trapeffect_rolling_boulder_trap(trap, trflags);
break;
case MAGIC_PORTAL:
trapeffect_magic_portal(trap, trflags);
break; break;
case VIBRATING_SQUARE: case VIBRATING_SQUARE: