MCPcopy Create free account
hub / github.com/NetHack/NetHack / rejectcasting

Function rejectcasting

src/spell.c:686–708  ·  view source on GitHub ↗

return True if spellcasting is inhibited; only covers a small subset of reasons why casting won't work */

Source from the content-addressed store, hash-verified

684/* return True if spellcasting is inhibited;
685 only covers a small subset of reasons why casting won't work */
686staticfn boolean
687rejectcasting(void)
688{
689 /* rejections which take place before selecting a particular spell */
690 if (Stunned) {
691 You("are too impaired to cast a spell.");
692 return TRUE;
693 } else if (!can_chant(&gy.youmonst)) {
694 You("are unable to chant the incantation.");
695 return TRUE;
696 } else if (!freehand() && !(uwep && uwep->otyp == QUARTERSTAFF)) {
697 /* Note: !freehand() occurs when weapon and shield (or two-handed
698 * weapon) are welded to hands, so "arms" probably doesn't need
699 * to be makeplural(bodypart(ARM)).
700 *
701 * But why isn't lack of free arms (for gesturing) an issue when
702 * poly'd hero has no limbs?
703 */
704 Your("arms are not free to cast!");
705 return TRUE;
706 }
707 return FALSE;
708}
709
710/*
711 * Return TRUE if a spell was picked, with the spell index in the return

Callers 2

getspellFunction · 0.85
spelleffects_checkFunction · 0.85

Calls 4

YouFunction · 0.85
can_chantFunction · 0.85
freehandFunction · 0.85
YourFunction · 0.85

Tested by

no test coverage detected