Unify dart trap
This commit is contained in:
+61
-48
@@ -13,7 +13,7 @@ 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 int FDECL(trapeffect_arrow_trap, (struct monst *, struct trap *, unsigned));
|
static int FDECL(trapeffect_arrow_trap, (struct monst *, struct trap *, unsigned));
|
||||||
static void FDECL(trapeffect_dart_trap, (struct trap *, unsigned));
|
static int FDECL(trapeffect_dart_trap, (struct monst *, struct trap *, unsigned));
|
||||||
static void FDECL(trapeffect_rocktrap, (struct trap *, unsigned));
|
static void FDECL(trapeffect_rocktrap, (struct trap *, unsigned));
|
||||||
static void FDECL(trapeffect_sqky_board, (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_bear_trap, (struct trap *, unsigned));
|
||||||
@@ -978,44 +978,72 @@ unsigned trflags;
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
trapeffect_dart_trap(trap, trflags)
|
trapeffect_dart_trap(mtmp, trap, trflags)
|
||||||
|
struct monst *mtmp;
|
||||||
struct trap *trap;
|
struct trap *trap;
|
||||||
unsigned trflags;
|
unsigned trflags;
|
||||||
{
|
{
|
||||||
struct obj *otmp;
|
struct obj *otmp;
|
||||||
int oldumort = u.umortality;
|
|
||||||
|
|
||||||
if (trap->once && trap->tseen && !rn2(15)) {
|
if (mtmp == &g.youmonst) {
|
||||||
You_hear("a soft click.");
|
int oldumort = u.umortality;
|
||||||
deltrap(trap);
|
|
||||||
newsym(u.ux, u.uy);
|
if (trap->once && trap->tseen && !rn2(15)) {
|
||||||
return;
|
You_hear("a soft click.");
|
||||||
}
|
deltrap(trap);
|
||||||
trap->once = 1;
|
newsym(u.ux, u.uy);
|
||||||
seetrap(trap);
|
return 0;
|
||||||
pline("A little dart shoots out at you!");
|
}
|
||||||
otmp = t_missile(DART, trap);
|
trap->once = 1;
|
||||||
if (!rn2(6))
|
seetrap(trap);
|
||||||
otmp->opoisoned = 1;
|
pline("A little dart shoots out at you!");
|
||||||
if (u.usteed && !rn2(2) && steedintrap(trap, otmp)) {
|
otmp = t_missile(DART, trap);
|
||||||
; /* nothing */
|
if (!rn2(6))
|
||||||
} else if (thitu(7, dmgval(otmp, &g.youmonst), &otmp, "little dart")) {
|
otmp->opoisoned = 1;
|
||||||
if (otmp) {
|
if (u.usteed && !rn2(2) && steedintrap(trap, otmp)) {
|
||||||
if (otmp->opoisoned)
|
; /* nothing */
|
||||||
poisoned("dart", A_CON, "little dart",
|
} else if (thitu(7, dmgval(otmp, &g.youmonst), &otmp, "little dart")) {
|
||||||
/* if damage triggered life-saving,
|
if (otmp) {
|
||||||
poison is limited to attrib loss */
|
if (otmp->opoisoned)
|
||||||
(u.umortality > oldumort) ? 0 : 10, TRUE);
|
poisoned("dart", A_CON, "little dart",
|
||||||
obfree(otmp, (struct obj *) 0);
|
/* if damage triggered life-saving,
|
||||||
|
poison is limited to attrib loss */
|
||||||
|
(u.umortality > oldumort) ? 0 : 10, TRUE);
|
||||||
|
obfree(otmp, (struct obj *) 0);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
place_object(otmp, u.ux, u.uy);
|
||||||
|
if (!Blind)
|
||||||
|
otmp->dknown = 1;
|
||||||
|
stackobj(otmp);
|
||||||
|
newsym(u.ux, u.uy);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
place_object(otmp, u.ux, u.uy);
|
boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed);
|
||||||
if (!Blind)
|
boolean see_it = cansee(mtmp->mx, mtmp->my);
|
||||||
otmp->dknown = 1;
|
boolean trapkilled = FALSE;
|
||||||
stackobj(otmp);
|
|
||||||
newsym(u.ux, u.uy);
|
if (trap->once && trap->tseen && !rn2(15)) {
|
||||||
|
if (in_sight && see_it)
|
||||||
|
pline("%s triggers a trap but nothing happens.",
|
||||||
|
Monnam(mtmp));
|
||||||
|
deltrap(trap);
|
||||||
|
newsym(mtmp->mx, mtmp->my);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
trap->once = 1;
|
||||||
|
otmp = t_missile(DART, trap);
|
||||||
|
if (!rn2(6))
|
||||||
|
otmp->opoisoned = 1;
|
||||||
|
if (in_sight)
|
||||||
|
seetrap(trap);
|
||||||
|
if (thitm(7, mtmp, otmp, 0, FALSE))
|
||||||
|
trapkilled = TRUE;
|
||||||
|
|
||||||
|
return trapkilled ? 2 : mtmp->mtrapped;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1720,7 +1748,7 @@ unsigned trflags;
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case DART_TRAP:
|
case DART_TRAP:
|
||||||
trapeffect_dart_trap(trap, trflags);
|
(void) trapeffect_dart_trap(&g.youmonst, trap, trflags);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ROCKTRAP:
|
case ROCKTRAP:
|
||||||
@@ -2448,22 +2476,7 @@ register struct monst *mtmp;
|
|||||||
case ARROW_TRAP:
|
case ARROW_TRAP:
|
||||||
return trapeffect_arrow_trap(mtmp, trap, 0);
|
return trapeffect_arrow_trap(mtmp, trap, 0);
|
||||||
case DART_TRAP:
|
case DART_TRAP:
|
||||||
if (trap->once && trap->tseen && !rn2(15)) {
|
return trapeffect_dart_trap(mtmp, trap, 0);
|
||||||
if (in_sight && see_it)
|
|
||||||
pline("%s triggers a trap but nothing happens.",
|
|
||||||
Monnam(mtmp));
|
|
||||||
deltrap(trap);
|
|
||||||
newsym(mtmp->mx, mtmp->my);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
trap->once = 1;
|
|
||||||
otmp = t_missile(DART, trap);
|
|
||||||
if (!rn2(6))
|
|
||||||
otmp->opoisoned = 1;
|
|
||||||
if (in_sight)
|
|
||||||
seetrap(trap);
|
|
||||||
if (thitm(7, mtmp, otmp, 0, FALSE))
|
|
||||||
trapkilled = TRUE;
|
|
||||||
break;
|
break;
|
||||||
case ROCKTRAP:
|
case ROCKTRAP:
|
||||||
if (trap->once && trap->tseen && !rn2(15)) {
|
if (trap->once && trap->tseen && !rn2(15)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user