#turn command */
| 2411 | |
| 2412 | /* #turn command */ |
| 2413 | int |
| 2414 | doturn(void) |
| 2415 | { |
| 2416 | /* Knights & Priest(esse)s only please */ |
| 2417 | const char *Gname; |
| 2418 | |
| 2419 | if (!Role_if(PM_CLERIC) && !Role_if(PM_KNIGHT)) { |
| 2420 | /* Try to use the "turn undead" spell. */ |
| 2421 | if (known_spell(SPE_TURN_UNDEAD)) |
| 2422 | return spelleffects(SPE_TURN_UNDEAD, FALSE, FALSE); |
| 2423 | You("don't know how to turn undead!"); |
| 2424 | return ECMD_OK; |
| 2425 | } |
| 2426 | if (!u.uconduct.gnostic++) |
| 2427 | livelog_printf(LL_CONDUCT, "rejected atheism by turning undead"); |
| 2428 | |
| 2429 | Gname = halu_gname(u.ualign.type); |
| 2430 | |
| 2431 | /* [What about needing free hands (does #turn involve any gesturing)?] */ |
| 2432 | if (!can_chant(&gy.youmonst)) { |
| 2433 | /* "evilness": "demons and undead" is too verbose and too precise */ |
| 2434 | You("are %s upon %s to turn aside evilness.", |
| 2435 | Strangled ? "not able to call" : "incapable of calling", Gname); |
| 2436 | /* violates agnosticism due to intent; conduct tracking is not |
| 2437 | supposed to affect play but we make an exception here: use a |
| 2438 | move if this is the first time agnostic conduct has been broken */ |
| 2439 | return (u.uconduct.gnostic == 1) ? ECMD_TIME : ECMD_OK; |
| 2440 | } |
| 2441 | if ((u.ualign.type != A_CHAOTIC |
| 2442 | && (is_demon(gy.youmonst.data) |
| 2443 | || is_undead(gy.youmonst.data) || is_vampshifter(&gy.youmonst))) |
| 2444 | || u.ugangr > 6) { /* "Die, mortal!" */ |
| 2445 | pline("For some reason, %s seems to ignore you.", Gname); |
| 2446 | aggravate(); |
| 2447 | exercise(A_WIS, FALSE); |
| 2448 | return ECMD_TIME; |
| 2449 | } |
| 2450 | if (Inhell) { |
| 2451 | pline("Since you are in Gehennom, %s %s help you.", |
| 2452 | /* not actually calling upon Moloch but use alternate |
| 2453 | phrasing anyway if hallucinatory feedback says it's him */ |
| 2454 | Gname, !strcmp(Gname, Moloch) ? "won't" : "can't"); |
| 2455 | aggravate(); |
| 2456 | return ECMD_TIME; |
| 2457 | } |
| 2458 | pline("Calling upon %s, you chant an arcane formula.", Gname); |
| 2459 | exercise(A_WIS, TRUE); |
| 2460 | |
| 2461 | /* note: does not perform unturn_dead() on victims' inventories */ |
| 2462 | turn_undead_range = BOLT_LIM + (u.ulevel / 5); /* 8 to 14 */ |
| 2463 | turn_undead_range *= turn_undead_range; |
| 2464 | turn_undead_msg_cnt = 0; |
| 2465 | |
| 2466 | iter_mons(maybe_turn_mon_iter); |
| 2467 | |
| 2468 | /* |
| 2469 | * There is no detrimental effect on self for successful #turn |
| 2470 | * while in demon or undead form. That can only be done while |
nothing calls this directly
no test coverage detected