the #down command */
| 1128 | |
| 1129 | /* the #down command */ |
| 1130 | int |
| 1131 | dodown(void) |
| 1132 | { |
| 1133 | struct trap *trap = 0; |
| 1134 | stairway *stway; |
| 1135 | boolean stairs_down, ladder_down; |
| 1136 | |
| 1137 | set_move_cmd(DIR_DOWN, 0); |
| 1138 | |
| 1139 | if (u_rooted()) |
| 1140 | return ECMD_TIME; |
| 1141 | |
| 1142 | if (stucksteed(TRUE)) { |
| 1143 | return ECMD_OK; |
| 1144 | } |
| 1145 | |
| 1146 | stairs_down = ladder_down = FALSE; |
| 1147 | if ((stway = stairway_at(u.ux, u.uy)) != 0 && !stway->up) { |
| 1148 | stairs_down = !stway->isladder; |
| 1149 | ladder_down = !stairs_down; |
| 1150 | } |
| 1151 | |
| 1152 | /* Levitation might be blocked, but player can still use '>' to |
| 1153 | turn off controlled levitation */ |
| 1154 | if (HLevitation || ELevitation) { |
| 1155 | if ((HLevitation & I_SPECIAL) || (ELevitation & W_ARTI)) { |
| 1156 | /* end controlled levitation */ |
| 1157 | if (ELevitation & W_ARTI) { |
| 1158 | struct obj *obj; |
| 1159 | |
| 1160 | for (obj = gi.invent; obj; obj = obj->nobj) { |
| 1161 | if (obj->oartifact |
| 1162 | && artifact_has_invprop(obj, LEVITATION)) { |
| 1163 | if (obj->age < svm.moves) |
| 1164 | obj->age = svm.moves; |
| 1165 | obj->age += rnz(100); |
| 1166 | } |
| 1167 | } |
| 1168 | } |
| 1169 | if (float_down(I_SPECIAL | TIMEOUT, W_ARTI)) { |
| 1170 | return ECMD_TIME; /* came down, so moved */ |
| 1171 | } else if (!HLevitation && !ELevitation) { |
| 1172 | Your("latent levitation ceases."); |
| 1173 | return ECMD_TIME; /* did something, effectively moved */ |
| 1174 | } |
| 1175 | } |
| 1176 | if (BLevitation) { |
| 1177 | ; /* weren't actually floating after all */ |
| 1178 | } else if (Blind) { |
| 1179 | /* glyph_to_cmap() is a macro which expands its argument many |
| 1180 | times; use this to do part of its work just once */ |
| 1181 | int glyph_at_uxuy = levl[u.ux][u.uy].glyph; |
| 1182 | |
| 1183 | /* Avoid alerting player to an unknown stair or ladder. |
| 1184 | * Changes the message for a covered, known staircase |
| 1185 | * too; staircase knowledge is not stored anywhere. |
| 1186 | */ |
| 1187 | if (stairs_down) |
nothing calls this directly
no test coverage detected