Use is_pit macro to check for (spiked) pit
This commit is contained in:
@@ -83,4 +83,6 @@ enum trap_types {
|
|||||||
TRAPNUM
|
TRAPNUM
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define is_pit(ttyp) ((ttyp) == PIT || (ttyp) == SPIKED_PIT)
|
||||||
|
|
||||||
#endif /* TRAP_H */
|
#endif /* TRAP_H */
|
||||||
|
|||||||
+2
-2
@@ -599,7 +599,7 @@ drag:
|
|||||||
|| !is_pool(uball->ox, uball->oy)
|
|| !is_pool(uball->ox, uball->oy)
|
||||||
|| levl[uball->ox][uball->oy].typ == POOL))
|
|| levl[uball->ox][uball->oy].typ == POOL))
|
||||||
|| ((t = t_at(uchain->ox, uchain->oy))
|
|| ((t = t_at(uchain->ox, uchain->oy))
|
||||||
&& (t->ttyp == PIT || t->ttyp == SPIKED_PIT || t->ttyp == HOLE
|
&& (is_pit(t->ttyp) || t->ttyp == HOLE
|
||||||
|| t->ttyp == TRAPDOOR))) {
|
|| t->ttyp == TRAPDOOR))) {
|
||||||
if (Levitation) {
|
if (Levitation) {
|
||||||
You_feel("a tug from the iron ball.");
|
You_feel("a tug from the iron ball.");
|
||||||
@@ -745,7 +745,7 @@ xchar x, y;
|
|||||||
if (!Levitation && !MON_AT(x, y) && !u.utrap
|
if (!Levitation && !MON_AT(x, y) && !u.utrap
|
||||||
&& (is_pool(x, y)
|
&& (is_pool(x, y)
|
||||||
|| ((t = t_at(x, y))
|
|| ((t = t_at(x, y))
|
||||||
&& (t->ttyp == PIT || t->ttyp == SPIKED_PIT
|
&& (is_pit(t->ttyp)
|
||||||
|| t->ttyp == TRAPDOOR || t->ttyp == HOLE)))) {
|
|| t->ttyp == TRAPDOOR || t->ttyp == HOLE)))) {
|
||||||
u.ux = x;
|
u.ux = x;
|
||||||
u.uy = y;
|
u.uy = y;
|
||||||
|
|||||||
@@ -312,8 +312,7 @@ dig(VOID_ARGS)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (context.digging.effort <= 50
|
if (context.digging.effort <= 50
|
||||||
|| (ttmp && (ttmp->ttyp == TRAPDOOR || ttmp->ttyp == PIT
|
|| (ttmp && (ttmp->ttyp == TRAPDOOR || is_pit(ttmp->ttyp)))) {
|
||||||
|| ttmp->ttyp == SPIKED_PIT))) {
|
|
||||||
return 1;
|
return 1;
|
||||||
} else if (ttmp && (ttmp->ttyp == LANDMINE
|
} else if (ttmp && (ttmp->ttyp == LANDMINE
|
||||||
|| (ttmp->ttyp == BEAR_TRAP && !u.utrap))) {
|
|| (ttmp->ttyp == BEAR_TRAP && !u.utrap))) {
|
||||||
@@ -803,7 +802,7 @@ coord *cc;
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if ((boulder_here = sobj_at(BOULDER, dig_x, dig_y)) != 0) {
|
} else if ((boulder_here = sobj_at(BOULDER, dig_x, dig_y)) != 0) {
|
||||||
if (ttmp && (ttmp->ttyp == PIT || ttmp->ttyp == SPIKED_PIT)
|
if (ttmp && is_pit(ttmp->ttyp)
|
||||||
&& rn2(2)) {
|
&& rn2(2)) {
|
||||||
pline_The("boulder settles into the %spit.",
|
pline_The("boulder settles into the %spit.",
|
||||||
(dig_x != u.ux || dig_y != u.uy) ? "adjacent " : "");
|
(dig_x != u.ux || dig_y != u.uy) ? "adjacent " : "");
|
||||||
@@ -1087,7 +1086,7 @@ struct obj *obj;
|
|||||||
KILLED_BY);
|
KILLED_BY);
|
||||||
} else if (u.utrap && u.utraptype == TT_PIT && trap
|
} else if (u.utrap && u.utraptype == TT_PIT && trap
|
||||||
&& (trap_with_u = t_at(u.ux, u.uy))
|
&& (trap_with_u = t_at(u.ux, u.uy))
|
||||||
&& (trap->ttyp == PIT || trap->ttyp == SPIKED_PIT)
|
&& is_pit(trap->ttyp)
|
||||||
&& !conjoined_pits(trap, trap_with_u, FALSE)) {
|
&& !conjoined_pits(trap, trap_with_u, FALSE)) {
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
@@ -1462,8 +1461,7 @@ zap_dig()
|
|||||||
struct trap *adjpit = t_at(zx, zy);
|
struct trap *adjpit = t_at(zx, zy);
|
||||||
if ((diridx < 8) && !conjoined_pits(adjpit, trap_with_u, FALSE)) {
|
if ((diridx < 8) && !conjoined_pits(adjpit, trap_with_u, FALSE)) {
|
||||||
digdepth = 0; /* limited to the adjacent location only */
|
digdepth = 0; /* limited to the adjacent location only */
|
||||||
if (!(adjpit && (adjpit->ttyp == PIT
|
if (!(adjpit && is_pit(adjpit->ttyp))) {
|
||||||
|| adjpit->ttyp == SPIKED_PIT))) {
|
|
||||||
char buf[BUFSZ];
|
char buf[BUFSZ];
|
||||||
cc.x = zx;
|
cc.x = zx;
|
||||||
cc.y = zy;
|
cc.y = zy;
|
||||||
@@ -1477,7 +1475,7 @@ zap_dig()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (adjpit
|
if (adjpit
|
||||||
&& (adjpit->ttyp == PIT || adjpit->ttyp == SPIKED_PIT)) {
|
&& is_pit(adjpit->ttyp)) {
|
||||||
int adjidx = (diridx + 4) % 8;
|
int adjidx = (diridx + 4) % 8;
|
||||||
trap_with_u->conjoined |= (1 << diridx);
|
trap_with_u->conjoined |= (1 << diridx);
|
||||||
adjpit->conjoined |= (1 << adjidx);
|
adjpit->conjoined |= (1 << adjidx);
|
||||||
@@ -1566,7 +1564,7 @@ zap_dig()
|
|||||||
|
|
||||||
if (pitflow && isok(flow_x, flow_y)) {
|
if (pitflow && isok(flow_x, flow_y)) {
|
||||||
struct trap *ttmp = t_at(flow_x, flow_y);
|
struct trap *ttmp = t_at(flow_x, flow_y);
|
||||||
if (ttmp && (ttmp->ttyp == PIT || ttmp->ttyp == SPIKED_PIT)) {
|
if (ttmp && is_pit(ttmp->ttyp)) {
|
||||||
schar filltyp = fillholetyp(ttmp->tx, ttmp->ty, TRUE);
|
schar filltyp = fillholetyp(ttmp->tx, ttmp->ty, TRUE);
|
||||||
if (filltyp != ROOM)
|
if (filltyp != ROOM)
|
||||||
pit_flow(ttmp, filltyp);
|
pit_flow(ttmp, filltyp);
|
||||||
@@ -1681,7 +1679,7 @@ struct trap *trap;
|
|||||||
schar filltyp;
|
schar filltyp;
|
||||||
{
|
{
|
||||||
if (trap && (filltyp != ROOM)
|
if (trap && (filltyp != ROOM)
|
||||||
&& (trap->ttyp == PIT || trap->ttyp == SPIKED_PIT)) {
|
&& is_pit(trap->ttyp)) {
|
||||||
struct trap t;
|
struct trap t;
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -783,7 +783,7 @@ register int x, y;
|
|||||||
|
|
||||||
/* if monster is in a physical trap, you see the trap too
|
/* if monster is in a physical trap, you see the trap too
|
||||||
*/
|
*/
|
||||||
if (tt == BEAR_TRAP || tt == PIT || tt == SPIKED_PIT
|
if (tt == BEAR_TRAP || is_pit(tt)
|
||||||
|| tt == WEB) {
|
|| tt == WEB) {
|
||||||
trap->tseen = TRUE;
|
trap->tseen = TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ const char *verb;
|
|||||||
if (obj->otyp == BOULDER && boulder_hits_pool(obj, x, y, FALSE)) {
|
if (obj->otyp == BOULDER && boulder_hits_pool(obj, x, y, FALSE)) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else if (obj->otyp == BOULDER && (t = t_at(x, y)) != 0
|
} else if (obj->otyp == BOULDER && (t = t_at(x, y)) != 0
|
||||||
&& (t->ttyp == PIT || t->ttyp == SPIKED_PIT
|
&& (is_pit(t->ttyp)
|
||||||
|| t->ttyp == TRAPDOOR || t->ttyp == HOLE)) {
|
|| t->ttyp == TRAPDOOR || t->ttyp == HOLE)) {
|
||||||
if (((mtmp = m_at(x, y)) && mtmp->mtrapped)
|
if (((mtmp = m_at(x, y)) && mtmp->mtrapped)
|
||||||
|| (u.utrap && u.ux == x && u.uy == y)) {
|
|| (u.utrap && u.ux == x && u.uy == y)) {
|
||||||
|
|||||||
+1
-1
@@ -495,7 +495,7 @@ xchar x, y;
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ((trap = t_at(x, y)) != 0) {
|
if ((trap = t_at(x, y)) != 0) {
|
||||||
if (((trap->ttyp == PIT || trap->ttyp == SPIKED_PIT) && !Passes_walls)
|
if ((is_pit(trap->ttyp) && !Passes_walls)
|
||||||
|| trap->ttyp == WEB) {
|
|| trap->ttyp == WEB) {
|
||||||
if (!trap->tseen)
|
if (!trap->tseen)
|
||||||
find_trap(trap);
|
find_trap(trap);
|
||||||
|
|||||||
+1
-1
@@ -744,7 +744,7 @@ int x, y;
|
|||||||
dotrap(ttmp, 0); /* doesn't print messages */
|
dotrap(ttmp, 0); /* doesn't print messages */
|
||||||
} else if (ttmp->ttyp == FIRE_TRAP) {
|
} else if (ttmp->ttyp == FIRE_TRAP) {
|
||||||
dotrap(ttmp, 0);
|
dotrap(ttmp, 0);
|
||||||
} else if ((ttmp->ttyp == PIT || ttmp->ttyp == SPIKED_PIT
|
} else if ((is_pit(ttmp->ttyp)
|
||||||
|| ttmp->ttyp == HOLE || ttmp->ttyp == TRAPDOOR)
|
|| ttmp->ttyp == HOLE || ttmp->ttyp == TRAPDOOR)
|
||||||
&& Sokoban) {
|
&& Sokoban) {
|
||||||
/* air currents overcome the recoil in Sokoban;
|
/* air currents overcome the recoil in Sokoban;
|
||||||
|
|||||||
+4
-5
@@ -151,8 +151,7 @@ moverock()
|
|||||||
|
|
||||||
if (mtmp && !noncorporeal(mtmp->data)
|
if (mtmp && !noncorporeal(mtmp->data)
|
||||||
&& (!mtmp->mtrapped
|
&& (!mtmp->mtrapped
|
||||||
|| !(ttmp && ((ttmp->ttyp == PIT)
|
|| !(ttmp && is_pit(ttmp->ttyp)))) {
|
||||||
|| (ttmp->ttyp == SPIKED_PIT))))) {
|
|
||||||
if (Blind)
|
if (Blind)
|
||||||
feel_location(sx, sy);
|
feel_location(sx, sy);
|
||||||
if (canspotmon(mtmp)) {
|
if (canspotmon(mtmp)) {
|
||||||
@@ -1205,7 +1204,7 @@ struct trap *desttrap; /* nonnull if another trap at <x,y> */
|
|||||||
break;
|
break;
|
||||||
case TT_PIT:
|
case TT_PIT:
|
||||||
if (desttrap && desttrap->tseen
|
if (desttrap && desttrap->tseen
|
||||||
&& (desttrap->ttyp == PIT || desttrap->ttyp == SPIKED_PIT))
|
&& is_pit(desttrap->ttyp))
|
||||||
return TRUE; /* move into adjacent pit */
|
return TRUE; /* move into adjacent pit */
|
||||||
/* try to escape; position stays same regardless of success */
|
/* try to escape; position stays same regardless of success */
|
||||||
climb_pit();
|
climb_pit();
|
||||||
@@ -1736,7 +1735,7 @@ domove()
|
|||||||
u.ux = mtmp->mx, u.uy = mtmp->my; /* resume swapping positions */
|
u.ux = mtmp->mx, u.uy = mtmp->my; /* resume swapping positions */
|
||||||
|
|
||||||
if (mtmp->mtrapped && (trap = t_at(mtmp->mx, mtmp->my)) != 0
|
if (mtmp->mtrapped && (trap = t_at(mtmp->mx, mtmp->my)) != 0
|
||||||
&& (trap->ttyp == PIT || trap->ttyp == SPIKED_PIT)
|
&& is_pit(trap->ttyp)
|
||||||
&& sobj_at(BOULDER, trap->tx, trap->ty)) {
|
&& sobj_at(BOULDER, trap->tx, trap->ty)) {
|
||||||
/* can't swap places with pet pinned in a pit by a boulder */
|
/* can't swap places with pet pinned in a pit by a boulder */
|
||||||
u.ux = u.ux0, u.uy = u.uy0; /* didn't move after all */
|
u.ux = u.ux0, u.uy = u.uy0; /* didn't move after all */
|
||||||
@@ -2100,7 +2099,7 @@ boolean pick;
|
|||||||
* If not a pit, pickup before triggering trap.
|
* If not a pit, pickup before triggering trap.
|
||||||
* If pit, trigger trap before pickup.
|
* If pit, trigger trap before pickup.
|
||||||
*/
|
*/
|
||||||
pit = (trap && (trap->ttyp == PIT || trap->ttyp == SPIKED_PIT));
|
pit = (trap && is_pit(trap->ttyp));
|
||||||
if (pick && !pit)
|
if (pick && !pit)
|
||||||
(void) pickup(1);
|
(void) pickup(1);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1744,7 +1744,7 @@ struct attack *mattk;
|
|||||||
|
|
||||||
if (!engulf_target(mtmp, &youmonst))
|
if (!engulf_target(mtmp, &youmonst))
|
||||||
return 0;
|
return 0;
|
||||||
if ((t && ((t->ttyp == PIT) || (t->ttyp == SPIKED_PIT)))
|
if ((t && is_pit(t->ttyp))
|
||||||
&& sobj_at(BOULDER, u.ux, u.uy))
|
&& sobj_at(BOULDER, u.ux, u.uy))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1349,7 +1349,7 @@ coord *tm;
|
|||||||
m = *tm;
|
m = *tm;
|
||||||
} else {
|
} else {
|
||||||
register int tryct = 0;
|
register int tryct = 0;
|
||||||
boolean avoid_boulder = (kind == PIT || kind == SPIKED_PIT
|
boolean avoid_boulder = (is_pit(kind)
|
||||||
|| kind == TRAPDOOR || kind == HOLE);
|
|| kind == TRAPDOOR || kind == HOLE);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@@ -1390,7 +1390,7 @@ coord *tm;
|
|||||||
in a pit and yet not be able to identify that the pit is there. */
|
in a pit and yet not be able to identify that the pit is there. */
|
||||||
if (lvl <= (unsigned) rnd(4)
|
if (lvl <= (unsigned) rnd(4)
|
||||||
&& kind != SQKY_BOARD && kind != RUST_TRAP
|
&& kind != SQKY_BOARD && kind != RUST_TRAP
|
||||||
&& kind != PIT && kind != SPIKED_PIT && kind < HOLE) {
|
&& !is_pit(kind) && kind < HOLE) {
|
||||||
/* Object generated by the trap; initially NULL, stays NULL if
|
/* Object generated by the trap; initially NULL, stays NULL if
|
||||||
we fail to generate an object or if the trap doesn't
|
we fail to generate an object or if the trap doesn't
|
||||||
generate objects. */
|
generate objects. */
|
||||||
|
|||||||
@@ -1446,7 +1446,7 @@ nexttry: /* eels prefer the water, but if there is no water nearby,
|
|||||||
if ((ttmp->ttyp != RUST_TRAP
|
if ((ttmp->ttyp != RUST_TRAP
|
||||||
|| mdat == &mons[PM_IRON_GOLEM])
|
|| mdat == &mons[PM_IRON_GOLEM])
|
||||||
&& ttmp->ttyp != STATUE_TRAP
|
&& ttmp->ttyp != STATUE_TRAP
|
||||||
&& ((ttmp->ttyp != PIT && ttmp->ttyp != SPIKED_PIT
|
&& ((!is_pit(ttmp->ttyp)
|
||||||
&& ttmp->ttyp != TRAPDOOR && ttmp->ttyp != HOLE)
|
&& ttmp->ttyp != TRAPDOOR && ttmp->ttyp != HOLE)
|
||||||
|| (!is_flyer(mdat) && !is_floater(mdat)
|
|| (!is_flyer(mdat) && !is_floater(mdat)
|
||||||
&& !is_clinger(mdat)) || Sokoban)
|
&& !is_clinger(mdat)) || Sokoban)
|
||||||
@@ -2256,7 +2256,7 @@ int xkill_flags; /* 1: suppress message, 2: suppress corpse, 4: pacifist */
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mtmp->mtrapped && (t = t_at(x, y)) != 0
|
if (mtmp->mtrapped && (t = t_at(x, y)) != 0
|
||||||
&& (t->ttyp == PIT || t->ttyp == SPIKED_PIT)) {
|
&& is_pit(t->ttyp)) {
|
||||||
if (sobj_at(BOULDER, x, y))
|
if (sobj_at(BOULDER, x, y))
|
||||||
nocorpse = TRUE; /* Prevent corpses/treasure being created
|
nocorpse = TRUE; /* Prevent corpses/treasure being created
|
||||||
"on top" of boulder that is about to fall in.
|
"on top" of boulder that is about to fall in.
|
||||||
@@ -2943,7 +2943,7 @@ register struct monst *mtmp;
|
|||||||
|| rn2(3) || mtmp == u.ustuck
|
|| rn2(3) || mtmp == u.ustuck
|
||||||
/* can't hide while trapped except in pits */
|
/* can't hide while trapped except in pits */
|
||||||
|| (mtmp->mtrapped && (t = t_at(mtmp->mx, mtmp->my)) != 0
|
|| (mtmp->mtrapped && (t = t_at(mtmp->mx, mtmp->my)) != 0
|
||||||
&& !(t->ttyp == PIT || t->ttyp == SPIKED_PIT))
|
&& !is_pit(t->ttyp))
|
||||||
|| (sensemon(mtmp) && distu(mtmp->mx, mtmp->my) <= 2))
|
|| (sensemon(mtmp) && distu(mtmp->mx, mtmp->my) <= 2))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@@ -2971,7 +2971,7 @@ struct monst *mtmp;
|
|||||||
; /* can't hide if holding you or held by you */
|
; /* can't hide if holding you or held by you */
|
||||||
} else if (is_u ? (u.utrap && u.utraptype != TT_PIT)
|
} else if (is_u ? (u.utrap && u.utraptype != TT_PIT)
|
||||||
: (mtmp->mtrapped && (t = t_at(x, y)) != 0
|
: (mtmp->mtrapped && (t = t_at(x, y)) != 0
|
||||||
&& !(t->ttyp == PIT || t->ttyp == SPIKED_PIT))) {
|
&& !is_pit(t->ttyp))) {
|
||||||
; /* can't hide while stuck in a non-pit trap */
|
; /* can't hide while stuck in a non-pit trap */
|
||||||
} else if (mtmp->data->mlet == S_EEL) {
|
} else if (mtmp->data->mlet == S_EEL) {
|
||||||
undetected = (is_pool(x, y) && !Is_waterlevel(&u.uz));
|
undetected = (is_pool(x, y) && !Is_waterlevel(&u.uz));
|
||||||
|
|||||||
+1
-1
@@ -126,7 +126,7 @@ int x, y;
|
|||||||
|
|
||||||
if (create && !((mtmp = m_at(x, y)) != 0 && mtmp->mtrapped
|
if (create && !((mtmp = m_at(x, y)) != 0 && mtmp->mtrapped
|
||||||
&& (t = t_at(x, y)) != 0
|
&& (t = t_at(x, y)) != 0
|
||||||
&& (t->ttyp == PIT || t->ttyp == SPIKED_PIT))) {
|
&& is_pit(t->ttyp))) {
|
||||||
int objgone = 0;
|
int objgone = 0;
|
||||||
|
|
||||||
if (down_gate(x, y) != -1)
|
if (down_gate(x, y) != -1)
|
||||||
|
|||||||
+1
-1
@@ -489,7 +489,7 @@ struct monst *mtmp;
|
|||||||
|
|
||||||
/* kludge to cut down on trap destruction (particularly portals) */
|
/* kludge to cut down on trap destruction (particularly portals) */
|
||||||
t = t_at(x, y);
|
t = t_at(x, y);
|
||||||
if (t && (t->ttyp == PIT || t->ttyp == SPIKED_PIT || t->ttyp == WEB
|
if (t && (is_pit(t->ttyp) || t->ttyp == WEB
|
||||||
|| t->ttyp == BEAR_TRAP))
|
|| t->ttyp == BEAR_TRAP))
|
||||||
t = 0; /* ok for monster to dig here */
|
t = 0; /* ok for monster to dig here */
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -249,7 +249,7 @@ int force;
|
|||||||
unsigned tu_pit = 0;
|
unsigned tu_pit = 0;
|
||||||
|
|
||||||
if (trap_at_u)
|
if (trap_at_u)
|
||||||
tu_pit = (trap_at_u->ttyp == PIT || trap_at_u->ttyp == SPIKED_PIT);
|
tu_pit = is_pit(trap_at_u->ttyp);
|
||||||
start_x = u.ux - (force * 2);
|
start_x = u.ux - (force * 2);
|
||||||
start_y = u.uy - (force * 2);
|
start_y = u.uy - (force * 2);
|
||||||
end_x = u.ux + (force * 2);
|
end_x = u.ux + (force * 2);
|
||||||
|
|||||||
+1
-1
@@ -279,7 +279,7 @@ int x, y;
|
|||||||
int tt = t ? t->ttyp : NO_TRAP;
|
int tt = t ? t->ttyp : NO_TRAP;
|
||||||
|
|
||||||
/* newsym lets you know of the trap, so mention it here */
|
/* newsym lets you know of the trap, so mention it here */
|
||||||
if (tt == BEAR_TRAP || tt == PIT || tt == SPIKED_PIT || tt == WEB)
|
if (tt == BEAR_TRAP || is_pit(tt) || tt == WEB)
|
||||||
Sprintf(eos(buf), ", trapped in %s",
|
Sprintf(eos(buf), ", trapped in %s",
|
||||||
an(defsyms[trap_to_defsym(tt)].explanation));
|
an(defsyms[trap_to_defsym(tt)].explanation));
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -2660,7 +2660,7 @@ fill_empty_maze()
|
|||||||
maze1xy(&mm, DRY);
|
maze1xy(&mm, DRY);
|
||||||
trytrap = rndtrap();
|
trytrap = rndtrap();
|
||||||
if (sobj_at(BOULDER, mm.x, mm.y))
|
if (sobj_at(BOULDER, mm.x, mm.y))
|
||||||
while (trytrap == PIT || trytrap == SPIKED_PIT
|
while (is_pit(trytrap)
|
||||||
|| trytrap == TRAPDOOR || trytrap == HOLE)
|
|| trytrap == TRAPDOOR || trytrap == HOLE)
|
||||||
trytrap = rndtrap();
|
trytrap = rndtrap();
|
||||||
(void) maketrap(mm.x, mm.y, trytrap);
|
(void) maketrap(mm.x, mm.y, trytrap);
|
||||||
|
|||||||
+20
-22
@@ -328,8 +328,7 @@ int x, y, typ;
|
|||||||
if (u.utrap && x == u.ux && y == u.uy
|
if (u.utrap && x == u.ux && y == u.uy
|
||||||
&& ((u.utraptype == TT_BEARTRAP && typ != BEAR_TRAP)
|
&& ((u.utraptype == TT_BEARTRAP && typ != BEAR_TRAP)
|
||||||
|| (u.utraptype == TT_WEB && typ != WEB)
|
|| (u.utraptype == TT_WEB && typ != WEB)
|
||||||
|| (u.utraptype == TT_PIT && typ != PIT
|
|| (u.utraptype == TT_PIT && !is_pit(typ))))
|
||||||
&& typ != SPIKED_PIT)))
|
|
||||||
u.utrap = 0;
|
u.utrap = 0;
|
||||||
/* old <tx,ty> remain valid */
|
/* old <tx,ty> remain valid */
|
||||||
} else if (IS_FURNITURE(lev->typ)
|
} else if (IS_FURNITURE(lev->typ)
|
||||||
@@ -862,7 +861,7 @@ unsigned trflags;
|
|||||||
nomul(0);
|
nomul(0);
|
||||||
|
|
||||||
/* KMH -- You can't escape the Sokoban level traps */
|
/* KMH -- You can't escape the Sokoban level traps */
|
||||||
if (Sokoban && (ttype == PIT || ttype == SPIKED_PIT
|
if (Sokoban && (is_pit(ttype)
|
||||||
|| ttype == HOLE || ttype == TRAPDOOR)) {
|
|| ttype == HOLE || ttype == TRAPDOOR)) {
|
||||||
/* The "air currents" message is still appropriate -- even when
|
/* The "air currents" message is still appropriate -- even when
|
||||||
* the hero isn't flying or levitating -- because it conveys the
|
* the hero isn't flying or levitating -- because it conveys the
|
||||||
@@ -875,7 +874,7 @@ unsigned trflags;
|
|||||||
/* then proceed to normal trap effect */
|
/* then proceed to normal trap effect */
|
||||||
} else if (already_seen && !forcetrap) {
|
} else if (already_seen && !forcetrap) {
|
||||||
if ((Levitation || (Flying && !plunged))
|
if ((Levitation || (Flying && !plunged))
|
||||||
&& (ttype == PIT || ttype == SPIKED_PIT || ttype == HOLE
|
&& (is_pit(ttype) || ttype == HOLE
|
||||||
|| ttype == BEAR_TRAP)) {
|
|| ttype == BEAR_TRAP)) {
|
||||||
You("%s over %s %s.", Levitation ? "float" : "fly",
|
You("%s over %s %s.", Levitation ? "float" : "fly",
|
||||||
a_your[trap->madeby_u],
|
a_your[trap->madeby_u],
|
||||||
@@ -885,7 +884,7 @@ unsigned trflags;
|
|||||||
if (!Fumbling && ttype != MAGIC_PORTAL && ttype != VIBRATING_SQUARE
|
if (!Fumbling && ttype != MAGIC_PORTAL && ttype != VIBRATING_SQUARE
|
||||||
&& ttype != ANTI_MAGIC && !forcebungle && !plunged
|
&& ttype != ANTI_MAGIC && !forcebungle && !plunged
|
||||||
&& !conj_pit && !adj_pit
|
&& !conj_pit && !adj_pit
|
||||||
&& (!rn2(5) || ((ttype == PIT || ttype == SPIKED_PIT)
|
&& (!rn2(5) || (is_pit(ttype)
|
||||||
&& is_clinger(youmonst.data)))) {
|
&& is_clinger(youmonst.data)))) {
|
||||||
You("escape %s %s.", (ttype == ARROW_TRAP && !trap->madeby_u)
|
You("escape %s %s.", (ttype == ARROW_TRAP && !trap->madeby_u)
|
||||||
? "an"
|
? "an"
|
||||||
@@ -2075,8 +2074,8 @@ register struct monst *mtmp;
|
|||||||
mtmp->mtrapped = 0; /* perhaps teleported? */
|
mtmp->mtrapped = 0; /* perhaps teleported? */
|
||||||
} else if (mtmp->mtrapped) { /* is currently in the trap */
|
} else if (mtmp->mtrapped) { /* is currently in the trap */
|
||||||
if (!trap->tseen && cansee(mtmp->mx, mtmp->my) && canseemon(mtmp)
|
if (!trap->tseen && cansee(mtmp->mx, mtmp->my) && canseemon(mtmp)
|
||||||
&& (trap->ttyp == SPIKED_PIT || trap->ttyp == BEAR_TRAP
|
&& (is_pit(trap->ttyp) || trap->ttyp == BEAR_TRAP
|
||||||
|| trap->ttyp == HOLE || trap->ttyp == PIT
|
|| trap->ttyp == HOLE
|
||||||
|| trap->ttyp == WEB)) {
|
|| trap->ttyp == WEB)) {
|
||||||
/* If you come upon an obviously trapped monster, then
|
/* If you come upon an obviously trapped monster, then
|
||||||
* you must be able to see the trap it's in too.
|
* you must be able to see the trap it's in too.
|
||||||
@@ -2086,7 +2085,7 @@ register struct monst *mtmp;
|
|||||||
|
|
||||||
if (!rn2(40)) {
|
if (!rn2(40)) {
|
||||||
if (sobj_at(BOULDER, mtmp->mx, mtmp->my)
|
if (sobj_at(BOULDER, mtmp->mx, mtmp->my)
|
||||||
&& (trap->ttyp == PIT || trap->ttyp == SPIKED_PIT)) {
|
&& is_pit(trap->ttyp)) {
|
||||||
if (!rn2(2)) {
|
if (!rn2(2)) {
|
||||||
mtmp->mtrapped = 0;
|
mtmp->mtrapped = 0;
|
||||||
if (canseemon(mtmp))
|
if (canseemon(mtmp))
|
||||||
@@ -2818,7 +2817,7 @@ int x, y;
|
|||||||
struct obj *otmp;
|
struct obj *otmp;
|
||||||
struct trap *t;
|
struct trap *t;
|
||||||
|
|
||||||
if ((t = t_at(x, y)) && ((t->ttyp == PIT) || (t->ttyp == SPIKED_PIT))
|
if ((t = t_at(x, y)) && is_pit(t->ttyp)
|
||||||
&& (otmp = sobj_at(BOULDER, x, y))) {
|
&& (otmp = sobj_at(BOULDER, x, y))) {
|
||||||
obj_extract_self(otmp);
|
obj_extract_self(otmp);
|
||||||
(void) flooreffects(otmp, x, y, "settle");
|
(void) flooreffects(otmp, x, y, "settle");
|
||||||
@@ -2865,7 +2864,7 @@ long hmask, emask; /* might cancel timeout */
|
|||||||
if (Punished && !carried(uball)
|
if (Punished && !carried(uball)
|
||||||
&& (is_pool(uball->ox, uball->oy)
|
&& (is_pool(uball->ox, uball->oy)
|
||||||
|| ((trap = t_at(uball->ox, uball->oy))
|
|| ((trap = t_at(uball->ox, uball->oy))
|
||||||
&& ((trap->ttyp == PIT) || (trap->ttyp == SPIKED_PIT)
|
&& (is_pit(trap->ttyp)
|
||||||
|| (trap->ttyp == TRAPDOOR) || (trap->ttyp == HOLE))))) {
|
|| (trap->ttyp == TRAPDOOR) || (trap->ttyp == HOLE))))) {
|
||||||
u.ux0 = u.ux;
|
u.ux0 = u.ux;
|
||||||
u.uy0 = u.uy;
|
u.uy0 = u.uy;
|
||||||
@@ -4313,7 +4312,7 @@ boolean force;
|
|||||||
if (ttmp) {
|
if (ttmp) {
|
||||||
Strcpy(the_trap, the(trapdescr));
|
Strcpy(the_trap, the(trapdescr));
|
||||||
if (boxcnt) {
|
if (boxcnt) {
|
||||||
if (ttmp->ttyp == PIT || ttmp->ttyp == SPIKED_PIT) {
|
if (is_pit(ttmp->ttyp)) {
|
||||||
You_cant("do much about %s%s.", the_trap,
|
You_cant("do much about %s%s.", the_trap,
|
||||||
u.utrap ? " that you're stuck in"
|
u.utrap ? " that you're stuck in"
|
||||||
: " while standing on the edge of it");
|
: " while standing on the edge of it");
|
||||||
@@ -4615,8 +4614,7 @@ boolean *noticed; /* set to true iff hero notices the effect; */
|
|||||||
/* if no trap here or it's not a falling trap, we're done
|
/* if no trap here or it's not a falling trap, we're done
|
||||||
(note: falling rock traps have a trapdoor in the ceiling) */
|
(note: falling rock traps have a trapdoor in the ceiling) */
|
||||||
if (!t || ((t->ttyp != TRAPDOOR && t->ttyp != ROCKTRAP)
|
if (!t || ((t->ttyp != TRAPDOOR && t->ttyp != ROCKTRAP)
|
||||||
&& (trapdoor_only || (t->ttyp != HOLE && t->ttyp != PIT
|
&& (trapdoor_only || (t->ttyp != HOLE && !is_pit(t->ttyp)))))
|
||||||
&& t->ttyp != SPIKED_PIT))))
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (ishero) {
|
if (ishero) {
|
||||||
@@ -4875,8 +4873,8 @@ boolean u_entering_trap2;
|
|||||||
if (!trap1 || !trap2)
|
if (!trap1 || !trap2)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!isok(trap2->tx, trap2->ty) || !isok(trap1->tx, trap1->ty)
|
if (!isok(trap2->tx, trap2->ty) || !isok(trap1->tx, trap1->ty)
|
||||||
|| !(trap2->ttyp == PIT || trap2->ttyp == SPIKED_PIT)
|
|| !is_pit(trap2->ttyp)
|
||||||
|| !(trap1->ttyp == PIT || trap1->ttyp == SPIKED_PIT)
|
|| !is_pit(trap1->ttyp)
|
||||||
|| (u_entering_trap2 && !(u.utrap && u.utraptype == TT_PIT)))
|
|| (u_entering_trap2 && !(u.utrap && u.utraptype == TT_PIT)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
dx = sgn(trap2->tx - trap1->tx);
|
dx = sgn(trap2->tx - trap1->tx);
|
||||||
@@ -4901,14 +4899,14 @@ struct trap *trap;
|
|||||||
int diridx, adjidx, x, y;
|
int diridx, adjidx, x, y;
|
||||||
struct trap *t;
|
struct trap *t;
|
||||||
|
|
||||||
if (trap && (trap->ttyp == PIT || trap->ttyp == SPIKED_PIT)) {
|
if (trap && is_pit(trap->ttyp)) {
|
||||||
for (diridx = 0; diridx < 8; ++diridx) {
|
for (diridx = 0; diridx < 8; ++diridx) {
|
||||||
if (trap->conjoined & (1 << diridx)) {
|
if (trap->conjoined & (1 << diridx)) {
|
||||||
x = trap->tx + xdir[diridx];
|
x = trap->tx + xdir[diridx];
|
||||||
y = trap->ty + ydir[diridx];
|
y = trap->ty + ydir[diridx];
|
||||||
if (isok(x, y)
|
if (isok(x, y)
|
||||||
&& (t = t_at(x, y)) != 0
|
&& (t = t_at(x, y)) != 0
|
||||||
&& (t->ttyp == PIT || t->ttyp == SPIKED_PIT)) {
|
&& is_pit(t->ttyp)) {
|
||||||
adjidx = (diridx + 4) % 8;
|
adjidx = (diridx + 4) % 8;
|
||||||
t->conjoined &= ~(1 << adjidx);
|
t->conjoined &= ~(1 << adjidx);
|
||||||
}
|
}
|
||||||
@@ -4925,8 +4923,8 @@ struct trap *adjtrap;
|
|||||||
struct trap *trap_with_u = t_at(u.ux0, u.uy0);
|
struct trap *trap_with_u = t_at(u.ux0, u.uy0);
|
||||||
|
|
||||||
if (trap_with_u && adjtrap && u.utrap && u.utraptype == TT_PIT &&
|
if (trap_with_u && adjtrap && u.utrap && u.utraptype == TT_PIT &&
|
||||||
(trap_with_u->ttyp == PIT || trap_with_u->ttyp == SPIKED_PIT) &&
|
is_pit(trap_with_u->ttyp) &&
|
||||||
(adjtrap->ttyp == PIT || adjtrap->ttyp == SPIKED_PIT)) {
|
is_pit(adjtrap->ttyp)) {
|
||||||
int idx;
|
int idx;
|
||||||
for (idx = 0; idx < 8; idx++) {
|
for (idx = 0; idx < 8; idx++) {
|
||||||
if (xdir[idx] == u.dx && ydir[idx] == u.dy)
|
if (xdir[idx] == u.dx && ydir[idx] == u.dy)
|
||||||
@@ -4955,7 +4953,7 @@ struct trap *trap;
|
|||||||
y = trap->ty + ydir[diridx];
|
y = trap->ty + ydir[diridx];
|
||||||
if (isok(x, y)) {
|
if (isok(x, y)) {
|
||||||
if ((t = t_at(x, y)) != 0
|
if ((t = t_at(x, y)) != 0
|
||||||
&& (t->ttyp == PIT || t->ttyp == SPIKED_PIT)) {
|
&& is_pit(t->ttyp)) {
|
||||||
trap->conjoined |= (1 << diridx);
|
trap->conjoined |= (1 << diridx);
|
||||||
join_adjacent_pits(t);
|
join_adjacent_pits(t);
|
||||||
} else
|
} else
|
||||||
@@ -4973,7 +4971,7 @@ uteetering_at_seen_pit(trap)
|
|||||||
struct trap *trap;
|
struct trap *trap;
|
||||||
{
|
{
|
||||||
if (trap && trap->tseen && (!u.utrap || u.utraptype != TT_PIT)
|
if (trap && trap->tseen && (!u.utrap || u.utraptype != TT_PIT)
|
||||||
&& (trap->ttyp == PIT || trap->ttyp == SPIKED_PIT))
|
&& is_pit(trap->ttyp))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -4987,7 +4985,7 @@ register struct trap *ttmp;
|
|||||||
/* some of these are arbitrary -dlc */
|
/* some of these are arbitrary -dlc */
|
||||||
if (ttmp && ((ttmp->ttyp == SQKY_BOARD) || (ttmp->ttyp == BEAR_TRAP)
|
if (ttmp && ((ttmp->ttyp == SQKY_BOARD) || (ttmp->ttyp == BEAR_TRAP)
|
||||||
|| (ttmp->ttyp == LANDMINE) || (ttmp->ttyp == FIRE_TRAP)
|
|| (ttmp->ttyp == LANDMINE) || (ttmp->ttyp == FIRE_TRAP)
|
||||||
|| (ttmp->ttyp == PIT) || (ttmp->ttyp == SPIKED_PIT)
|
|| is_pit(ttmp->ttyp)
|
||||||
|| (ttmp->ttyp == HOLE) || (ttmp->ttyp == TRAPDOOR)
|
|| (ttmp->ttyp == HOLE) || (ttmp->ttyp == TRAPDOOR)
|
||||||
|| (ttmp->ttyp == TELEP_TRAP) || (ttmp->ttyp == LEVEL_TELEP)
|
|| (ttmp->ttyp == TELEP_TRAP) || (ttmp->ttyp == LEVEL_TELEP)
|
||||||
|| (ttmp->ttyp == WEB) || (ttmp->ttyp == MAGIC_TRAP)
|
|| (ttmp->ttyp == WEB) || (ttmp->ttyp == MAGIC_TRAP)
|
||||||
|
|||||||
@@ -3373,7 +3373,7 @@ struct obj **pobj; /* object tossed/used, set to NULL
|
|||||||
The(distant_name(obj, xname))); /* lame */
|
The(distant_name(obj, xname))); /* lame */
|
||||||
range = 0;
|
range = 0;
|
||||||
} else if (Sokoban && (t = t_at(x, y)) != 0
|
} else if (Sokoban && (t = t_at(x, y)) != 0
|
||||||
&& (t->ttyp == PIT || t->ttyp == SPIKED_PIT
|
&& (is_pit(t->ttyp)
|
||||||
|| t->ttyp == HOLE || t->ttyp == TRAPDOOR)) {
|
|| t->ttyp == HOLE || t->ttyp == TRAPDOOR)) {
|
||||||
/* hero falls into the trap, so ball stops */
|
/* hero falls into the trap, so ball stops */
|
||||||
range = 0;
|
range = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user