MCPcopy Index your code
hub / github.com/NetHack/NetHack / use_camera

Function use_camera

src/apply.c:78–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78staticfn int
79use_camera(struct obj *obj)
80{
81 if (Underwater) {
82 pline("Using your camera underwater would void the warranty.");
83 return ECMD_OK;
84 }
85 if (!getdir((char *) 0))
86 return ECMD_CANCEL;
87
88 if (obj->spe <= 0) {
89 pline1(nothing_happens);
90 return ECMD_TIME;
91 }
92 consume_obj_charge(obj, TRUE);
93
94 if (obj->cursed && !rn2(2)) {
95 (void) zapyourself(obj, TRUE);
96 } else if (u.uswallow) {
97 You("take a picture of %s %s.", s_suffix(mon_nam(u.ustuck)),
98 mbodypart(u.ustuck, STOMACH));
99 } else if (u.dz) {
100 You("take a picture of the %s.",
101 (u.dz > 0) ? surface(u.ux, u.uy) : ceiling(u.ux, u.uy));
102 } else if (!u.dx && !u.dy) {
103 /* TODO: we ought to have a "selfie" joke here... */
104 (void) zapyourself(obj, TRUE);
105 } else {
106 do_blinding_ray(obj);
107 }
108 return ECMD_TIME;
109}
110
111staticfn int
112use_towel(struct obj *obj)

Callers 1

doapplyFunction · 0.85

Calls 12

getdirFunction · 0.85
consume_obj_chargeFunction · 0.85
rn2Function · 0.85
zapyourselfFunction · 0.85
YouFunction · 0.85
s_suffixFunction · 0.85
mon_namFunction · 0.85
mbodypartFunction · 0.85
surfaceFunction · 0.85
ceilingFunction · 0.85
do_blinding_rayFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected