#pray command */
| 2196 | |
| 2197 | /* #pray command */ |
| 2198 | int |
| 2199 | dopray(void) |
| 2200 | { |
| 2201 | boolean ok; |
| 2202 | |
| 2203 | /* |
| 2204 | * If ParanoidPray is set, confirm prayer to avoid accidental slips |
| 2205 | * of Alt+p. If ParanoidConfirm is also set, require "yes" rather |
| 2206 | * than just "y" (will also require "no" to decline). |
| 2207 | */ |
| 2208 | if (ParanoidPray) { |
| 2209 | ok = paranoid_query(ParanoidConfirm, |
| 2210 | "Are you sure you want to pray?"); |
| 2211 | #if 0 |
| 2212 | /* clear command recall buffer; otherwise ^A to repeat p(ray) would |
| 2213 | do so without confirmation (if 'ok') or do nothing (if '!ok') */ |
| 2214 | cmdq_clear(CQ_REPEAT); |
| 2215 | cmdq_add_ec(CQ_REPEAT, dopray); |
| 2216 | #endif |
| 2217 | if (!ok) /* declined the "are you sure?" confirmation */ |
| 2218 | return ECMD_OK; |
| 2219 | } |
| 2220 | |
| 2221 | if (!u.uconduct.gnostic++) |
| 2222 | /* breaking conduct should probably occur in can_pray() at |
| 2223 | * "You begin praying to %s", as demons who find praying repugnant |
| 2224 | * should not break conduct. Also we can add more detail to the |
| 2225 | * livelog message as p_aligntyp will be known. |
| 2226 | */ |
| 2227 | livelog_printf(LL_CONDUCT, "rejected atheism with a prayer"); |
| 2228 | |
| 2229 | /* set up p_type and p_alignment */ |
| 2230 | if (!can_pray(TRUE)) |
| 2231 | return ECMD_OK; |
| 2232 | |
| 2233 | if (wizard && gp.p_type >= 0) { |
| 2234 | static const char forcesuccess[] = "Force the gods to be pleased?"; |
| 2235 | |
| 2236 | /* if we asked "are you sure?" above we suppressed the response |
| 2237 | from the do-again buffer, so need to suppress this response too; |
| 2238 | otherwise subsequent ^A would use this answer for "are you sure?" |
| 2239 | and bypass confirmation */ |
| 2240 | if (ParanoidPray) { |
| 2241 | boolean save_doagain = gi.in_doagain; |
| 2242 | |
| 2243 | gi.in_doagain = FALSE; |
| 2244 | ok = (YN(forcesuccess) == 'y'); |
| 2245 | gi.in_doagain = save_doagain; |
| 2246 | } else { |
| 2247 | ok = (y_n(forcesuccess) == 'y'); |
| 2248 | } |
| 2249 | if (ok) { |
| 2250 | u.ublesscnt = 0; |
| 2251 | if (u.uluck < 0) |
| 2252 | u.uluck = 0; |
| 2253 | if (u.ualign.record <= 0) |
| 2254 | u.ualign.record = 1; |
| 2255 | u.ugangr = 0; |
nothing calls this directly
no test coverage detected