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

Function domonability

src/cmd.c:889–949  ·  view source on GitHub ↗

#monster command - use special monster ability while polymorphed */

Source from the content-addressed store, hash-verified

887
888/* #monster command - use special monster ability while polymorphed */
889int
890domonability(void)
891{
892 struct permonst *uptr = gy.youmonst.data;
893 boolean might_hide = (is_hider(uptr) || hides_under(uptr));
894 char c = '\0';
895
896 if (might_hide && webmaker(uptr)) {
897 c = yn_function("Hide [h] or spin a web [s]?",
898 hidespinchars, 'q', TRUE);
899 if (c == 'q' || c == '\033')
900 return ECMD_OK;
901 }
902 if (can_breathe(uptr))
903 return dobreathe();
904 else if (attacktype(uptr, AT_SPIT))
905 return dospit();
906 else if (uptr->mlet == S_NYMPH)
907 return doremove();
908 else if (attacktype(uptr, AT_GAZE))
909 return dogaze();
910 else if (is_were(uptr))
911 return dosummon();
912 else if (c ? c == 'h' : might_hide)
913 return dohide();
914 else if (c ? c == 's' : webmaker(uptr))
915 return dospinweb();
916 else if (is_mind_flayer(uptr))
917 return domindblast();
918 else if (u.umonnum == PM_GREMLIN) {
919 if (IS_FOUNTAIN(levl[u.ux][u.uy].typ)) {
920 if (split_mon(&gy.youmonst, (struct monst *) 0))
921 dryup(u.ux, u.uy, TRUE);
922 } else if (is_pool(u.ux, u.uy)) {
923 /* is_pool: might be wearing water walking boots or amulet of
924 magical breathing */
925 (void) split_mon(&gy.youmonst, (struct monst *) 0);
926 } else {
927 There("is no fountain here.");
928 }
929 } else if (is_unicorn(uptr)) {
930 use_unicorn_horn((struct obj **) 0);
931 return ECMD_TIME;
932 } else if (uptr->msound == MS_SHRIEK) {
933 You("shriek.");
934 if (u.uburied)
935 pline("Unfortunately sound does not carry well through rock.");
936 else
937 aggravate();
938 } else if (is_vampire(uptr) || is_vampshifter(&gy.youmonst)) {
939 return dopoly();
940 } else if (u.usteed && can_breathe(u.usteed->data)) {
941 (void) pet_ranged_attk(u.usteed, TRUE);
942 return ECMD_TIME;
943 } else if (Upolyd) {
944 pline("Any special ability you may have is purely reflexive.");
945 } else {
946 You("don't have a special ability in your normal form!");

Callers

nothing calls this directly

Calls 15

yn_functionFunction · 0.85
dobreatheFunction · 0.85
attacktypeFunction · 0.85
dospitFunction · 0.85
doremoveFunction · 0.85
dogazeFunction · 0.85
dosummonFunction · 0.85
dohideFunction · 0.85
dospinwebFunction · 0.85
domindblastFunction · 0.85
split_monFunction · 0.85
dryupFunction · 0.85

Tested by

no test coverage detected