Unify fire traps

This commit is contained in:
Pasi Kallinen
2020-12-10 19:04:30 +02:00
parent c15d062502
commit ed3a736bd8
+24 -18
View File
@@ -26,7 +26,7 @@ static int FDECL(trapeffect_telep_trap, (struct monst *, struct trap *, unsigned
static int FDECL(trapeffect_level_telep, (struct monst *, struct trap *, unsigned)); static int FDECL(trapeffect_level_telep, (struct monst *, struct trap *, unsigned));
static int FDECL(trapeffect_web, (struct monst *, struct trap *, unsigned)); 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 void FDECL(trapeffect_magic_trap, (struct trap *, unsigned)); static int FDECL(trapeffect_magic_trap, (struct monst *, struct trap *, unsigned));
static void FDECL(trapeffect_anti_magic, (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_poly_trap, (struct trap *, unsigned));
static void FDECL(trapeffect_landmine, (struct trap *, unsigned)); static void FDECL(trapeffect_landmine, (struct trap *, unsigned));
@@ -1926,24 +1926,32 @@ unsigned trflags;
return 0; return 0;
} }
static void static int
trapeffect_magic_trap(trap, trflags) trapeffect_magic_trap(mtmp, trap, trflags)
struct monst *mtmp;
struct trap *trap; struct trap *trap;
unsigned trflags; unsigned trflags;
{ {
seetrap(trap); if (mtmp == &g.youmonst) {
if (!rn2(30)) { seetrap(trap);
deltrap(trap); if (!rn2(30)) {
newsym(u.ux, u.uy); /* update position */ deltrap(trap);
You("are caught in a magical explosion!"); newsym(u.ux, u.uy); /* update position */
losehp(rnd(10), "magical explosion", KILLED_BY_AN); You("are caught in a magical explosion!");
Your("body absorbs some of the magical energy!"); losehp(rnd(10), "magical explosion", KILLED_BY_AN);
u.uen = (u.uenmax += 2); Your("body absorbs some of the magical energy!");
return; u.uen = (u.uenmax += 2);
return 0;
} else {
domagictrap();
}
(void) steedintrap(trap, (struct obj *) 0);
} else { } else {
domagictrap(); /* A magic trap. Monsters usually immune. */
if (!rn2(21))
return trapeffect_fire_trap(mtmp, trap, trflags);
} }
(void) steedintrap(trap, (struct obj *) 0); return 0;
} }
static void static void
@@ -2236,7 +2244,7 @@ unsigned trflags;
break; break;
case MAGIC_TRAP: /* A magic trap. */ case MAGIC_TRAP: /* A magic trap. */
trapeffect_magic_trap(trap, trflags); (void) trapeffect_magic_trap(&g.youmonst, trap, trflags);
break; break;
case ANTI_MAGIC: case ANTI_MAGIC:
@@ -2940,9 +2948,7 @@ register struct monst *mtmp;
case STATUE_TRAP: case STATUE_TRAP:
return trapeffect_statue_trap(mtmp, trap, 0); return trapeffect_statue_trap(mtmp, trap, 0);
case MAGIC_TRAP: case MAGIC_TRAP:
/* A magic trap. Monsters usually immune. */ return trapeffect_statue_trap(mtmp, trap, 0);
if (!rn2(21))
goto mfiretrap;
break; break;
case ANTI_MAGIC: case ANTI_MAGIC:
/* similar to hero's case, more or less */ /* similar to hero's case, more or less */