| 2010 | } |
| 2011 | |
| 2012 | staticfn int |
| 2013 | trapeffect_hole( |
| 2014 | struct monst *mtmp, |
| 2015 | struct trap *trap, |
| 2016 | unsigned int trflags) |
| 2017 | { |
| 2018 | if (mtmp == &gy.youmonst) { |
| 2019 | if (!Can_fall_thru(&u.uz)) { |
| 2020 | seetrap(trap); /* normally done in fall_through */ |
| 2021 | impossible("dotrap: %ss cannot exist on this level.", |
| 2022 | trapname(trap->ttyp, TRUE)); |
| 2023 | return Trap_Effect_Finished; /* don't activate it after all */ |
| 2024 | } |
| 2025 | fall_through(TRUE, (trflags & TOOKPLUNGE)); |
| 2026 | } else { |
| 2027 | int tt = trap->ttyp; |
| 2028 | struct permonst *mptr = mtmp->data; |
| 2029 | boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed); |
| 2030 | boolean forcetrap = ((trflags & FORCETRAP) != 0); |
| 2031 | boolean inescapable = (forcetrap || (Sokoban && !trap->madeby_u)); |
| 2032 | |
| 2033 | if (!Can_fall_thru(&u.uz)) { |
| 2034 | impossible("mintrap: %ss cannot exist on this level.", |
| 2035 | trapname(tt, TRUE)); |
| 2036 | return Trap_Effect_Finished; /* don't activate it after all */ |
| 2037 | } |
| 2038 | if (!grounded(mptr) || (mtmp->wormno && count_wsegs(mtmp) > 5) |
| 2039 | || mptr->msize >= MZ_HUGE) { |
| 2040 | if (forcetrap && !Sokoban) { |
| 2041 | /* openfallingtrap; not inescapable here */ |
| 2042 | if (in_sight) { |
| 2043 | seetrap(trap); |
| 2044 | if (tt == TRAPDOOR) |
| 2045 | pline_mon(mtmp, |
| 2046 | "A trap door opens, but %s doesn't fall through.", |
| 2047 | mon_nam(mtmp)); |
| 2048 | else /* (tt == HOLE) */ |
| 2049 | pline_mon(mtmp, |
| 2050 | "%s doesn't fall through the hole.", |
| 2051 | Monnam(mtmp)); |
| 2052 | } |
| 2053 | return Trap_Effect_Finished; /* inescapable = FALSE; */ |
| 2054 | } |
| 2055 | if (inescapable) { /* sokoban hole */ |
| 2056 | if (in_sight) { |
| 2057 | pline_mon(mtmp, |
| 2058 | "%s seems to be yanked down!", Monnam(mtmp)); |
| 2059 | seetrap(trap); |
| 2060 | } |
| 2061 | } else |
| 2062 | return Trap_Effect_Finished; |
| 2063 | } |
| 2064 | return trapeffect_level_telep(mtmp, trap, trflags); |
| 2065 | } |
| 2066 | return Trap_Effect_Finished; |
| 2067 | } |
| 2068 | |
| 2069 | staticfn int |
no test coverage detected