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

Function use_mirror

src/apply.c:1017–1199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1015static const char look_str[] = "look %s.";
1016
1017staticfn int
1018use_mirror(struct obj *obj)
1019{
1020 const char *mirror, *uvisage;
1021 struct monst *mtmp;
1022 unsigned how_seen;
1023 char mlet;
1024 boolean vis, invis_mirror, useeit, monable;
1025
1026 if (!getdir((char *) 0))
1027 return ECMD_CANCEL;
1028 invis_mirror = Invis;
1029 useeit = !Blind && (!invis_mirror || See_invisible);
1030 uvisage = beautiful();
1031 mirror = simpleonames(obj); /* "mirror" or "looking glass" */
1032 if (obj->cursed && !rn2(2)) {
1033 if (!Blind)
1034 pline_The("%s fogs up and doesn't reflect!", mirror);
1035 else
1036 pline("%s", nothing_seems_to_happen);
1037 return ECMD_TIME;
1038 }
1039 if (!u.dx && !u.dy && !u.dz) {
1040 if (!useeit) {
1041 You_cant("see your %s %s.", uvisage, body_part(FACE));
1042 } else {
1043 if (u.umonnum == PM_FLOATING_EYE) {
1044 if (Free_action) {
1045 You("stiffen momentarily under your gaze.");
1046 } else {
1047 if (Hallucination)
1048 pline("Yow! The %s stares back!", mirror);
1049 else
1050 pline("Yikes! You've frozen yourself!");
1051 if (!Hallucination || !rn2(4)) {
1052 nomul(-rnd(MAXULEV + 6 - u.ulevel));
1053 gm.multi_reason = "gazing into a mirror";
1054 }
1055 gn.nomovemsg = 0; /* default, "you can move again" */
1056 }
1057 } else if (is_vampire(gy.youmonst.data)
1058 || is_vampshifter(&gy.youmonst)) {
1059 You("don't have a reflection.");
1060 } else if (u.umonnum == PM_UMBER_HULK) {
1061 pline("Huh? That doesn't look like you!");
1062 make_confused(HConfusion + d(3, 4), FALSE);
1063 } else if (Hallucination) {
1064 You(look_str, hcolor((char *) 0));
1065 } else if (Sick) {
1066 You(look_str, "peaked");
1067 } else if (u.uhs >= WEAK) {
1068 You(look_str, "undernourished");
1069 } else if (Upolyd) {
1070 You("look like %s.", an(pmname(&mons[u.umonnum], Ugender)));
1071 } else {
1072 You("look as %s as ever.", uvisage);
1073 }
1074 }

Callers 1

doapplyFunction · 0.85

Calls 15

getdirFunction · 0.85
beautifulFunction · 0.85
simpleonamesFunction · 0.85
rn2Function · 0.85
pline_TheFunction · 0.85
You_cantFunction · 0.85
body_partFunction · 0.85
YouFunction · 0.85
nomulFunction · 0.85
rndFunction · 0.85
make_confusedFunction · 0.85
dFunction · 0.85

Tested by

no test coverage detected