shared code for climbing out of a pit */
| 4180 | |
| 4181 | /* shared code for climbing out of a pit */ |
| 4182 | void |
| 4183 | climb_pit(void) |
| 4184 | { |
| 4185 | const char *pitname; |
| 4186 | |
| 4187 | if (!u.utrap || u.utraptype != TT_PIT) |
| 4188 | return; |
| 4189 | |
| 4190 | pitname = trapname(PIT, FALSE); |
| 4191 | if (Passes_walls) { |
| 4192 | /* marked as trapped so they can pick things up */ |
| 4193 | You("ascend from the %s.", pitname); |
| 4194 | reset_utrap(FALSE); |
| 4195 | fill_pit(u.ux, u.uy); |
| 4196 | gv.vision_full_recalc = 1; /* vision limits change */ |
| 4197 | } else if (!rn2(2) && sobj_at(BOULDER, u.ux, u.uy)) { |
| 4198 | Your("%s gets stuck in a crevice.", body_part(LEG)); |
| 4199 | display_nhwindow(WIN_MESSAGE, FALSE); |
| 4200 | clear_nhwindow(WIN_MESSAGE); |
| 4201 | You("free your %s.", body_part(LEG)); |
| 4202 | } else if ((Flying || is_clinger(gy.youmonst.data)) && !Sokoban) { |
| 4203 | /* eg fell in pit, then poly'd to a flying monster; |
| 4204 | or used '>' to deliberately enter it */ |
| 4205 | You("%s from the %s.", u_locomotion("climb"), pitname); |
| 4206 | reset_utrap(FALSE); |
| 4207 | fill_pit(u.ux, u.uy); |
| 4208 | gv.vision_full_recalc = 1; /* vision limits change */ |
| 4209 | } else if (!(--u.utrap) || m_easy_escape_pit(&gy.youmonst)) { |
| 4210 | reset_utrap(FALSE); |
| 4211 | You("%s to the edge of the %s.", |
| 4212 | (Sokoban && Levitation) |
| 4213 | ? "struggle against the air currents and float" |
| 4214 | : u.usteed ? "ride" : "crawl", |
| 4215 | pitname); |
| 4216 | fill_pit(u.ux, u.uy); |
| 4217 | gv.vision_full_recalc = 1; /* vision limits change */ |
| 4218 | } else if (u.dz || flags.verbose) { |
| 4219 | /* these should use 'pitname' rather than "pit" for hallucination |
| 4220 | but that would nullify Norep (this message can be repeated |
| 4221 | many times without further user intervention by using a run |
| 4222 | attempt to keep retrying to escape from the pit) */ |
| 4223 | if (u.usteed) |
| 4224 | Norep("%s is still in a pit.", YMonnam(u.usteed)); |
| 4225 | else |
| 4226 | Norep((Hallucination && !rn2(5)) |
| 4227 | ? "You've fallen, and you can't get up." |
| 4228 | : "You are still in a pit."); |
| 4229 | } |
| 4230 | } |
| 4231 | |
| 4232 | staticfn void |
| 4233 | dofiretrap( |
no test coverage detected