| 2993 | } |
| 2994 | |
| 2995 | void |
| 2996 | dotrap(struct trap *trap, unsigned trflags) |
| 2997 | { |
| 2998 | int ttype = trap->ttyp; |
| 2999 | boolean already_seen = trap->tseen, |
| 3000 | forcetrap = ((trflags & FORCETRAP) != 0 |
| 3001 | || (trflags & FAILEDUNTRAP) != 0), |
| 3002 | forcebungle = (trflags & FORCEBUNGLE) != 0, |
| 3003 | plunged = (trflags & TOOKPLUNGE) != 0, |
| 3004 | conj_pit = conjoined_pits(trap, t_at(u.ux0, u.uy0), TRUE), |
| 3005 | adj_pit = adj_nonconjoined_pit(trap); |
| 3006 | |
| 3007 | nomul(0); |
| 3008 | |
| 3009 | if (fixed_tele_trap(trap)) { |
| 3010 | trflags |= FORCETRAP; |
| 3011 | forcetrap = TRUE; |
| 3012 | } |
| 3013 | |
| 3014 | /* KMH -- You can't escape the Sokoban level traps */ |
| 3015 | if (Sokoban && (is_pit(ttype) || is_hole(ttype))) { |
| 3016 | /* The "air currents" message is still appropriate -- even when |
| 3017 | * the hero isn't flying or levitating -- because it conveys the |
| 3018 | * reason why the player cannot escape the trap with a dexterity |
| 3019 | * check, clinging to the ceiling, etc. |
| 3020 | */ |
| 3021 | pline("Air currents pull you down into %s %s!", |
| 3022 | a_your[trap->madeby_u], |
| 3023 | trapname(ttype, TRUE)); /* do force "pit" while hallucinating */ |
| 3024 | /* then proceed to normal trap effect */ |
| 3025 | } else if (!forcetrap) { |
| 3026 | if (floor_trigger(ttype) && check_in_air(&gy.youmonst, trflags)) { |
| 3027 | if (already_seen) { |
| 3028 | You("%s over %s %s.", u_locomotion("step"), |
| 3029 | (ttype == ARROW_TRAP && !trap->madeby_u) |
| 3030 | ? "an" : a_your[trap->madeby_u], |
| 3031 | trapname(ttype, FALSE)); |
| 3032 | } |
| 3033 | return; |
| 3034 | } |
| 3035 | if (already_seen && !Fumbling && !undestroyable_trap(ttype) |
| 3036 | && ttype != ANTI_MAGIC && !forcebungle && !plunged |
| 3037 | && !conj_pit && !adj_pit |
| 3038 | && (!rn2(5) || (is_pit(ttype) && is_clinger(gy.youmonst.data)))) { |
| 3039 | You("escape %s %s.", (ttype == ARROW_TRAP && !trap->madeby_u) |
| 3040 | ? "an" |
| 3041 | : a_your[trap->madeby_u], |
| 3042 | trapname(ttype, FALSE)); |
| 3043 | return; |
| 3044 | } |
| 3045 | } |
| 3046 | |
| 3047 | if (u.usteed) |
| 3048 | mon_learns_traps(u.usteed, ttype); |
| 3049 | mons_see_trap(trap); |
| 3050 | |
| 3051 | /* |
| 3052 | * Note: |
no test coverage detected