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

Function use_tinning_kit

src/apply.c:2176–2256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2174}
2175
2176staticfn void
2177use_tinning_kit(struct obj *obj)
2178{
2179 struct obj *corpse, *can;
2180 struct permonst *mptr;
2181
2182 /* This takes only 1 move. If this is to be changed to take many
2183 * moves, we've got to deal with decaying corpses...
2184 */
2185 if (obj->spe <= 0) {
2186 You("seem to be out of tins.");
2187 return;
2188 }
2189 if (!(corpse = floorfood("tin", 2)))
2190 return;
2191 if (corpse->oeaten) {
2192 You("cannot tin %s which is partly eaten.", something);
2193 return;
2194 }
2195 mptr = &mons[corpse->corpsenm];
2196 if (touch_petrifies(mptr) && !Stone_resistance && !uarmg) {
2197 char kbuf[BUFSZ];
2198 const char *corpse_name = an(cxname(corpse));
2199
2200 if (poly_when_stoned(gy.youmonst.data)) {
2201 You("tin %s without wearing gloves.", corpse_name);
2202 kbuf[0] = '\0';
2203 } else {
2204 pline("Tinning %s without wearing gloves is a fatal mistake...",
2205 corpse_name);
2206 Sprintf(kbuf, "trying to tin %s without gloves", corpse_name);
2207 }
2208 instapetrify(kbuf);
2209 }
2210 if (is_rider(mptr)) {
2211 if (revive_corpse(corpse))
2212 verbalize("Yes... But War does not preserve its enemies...");
2213 else
2214 pline_The("corpse evades your grasp.");
2215 return;
2216 }
2217 if (mptr->cnutrit == 0) {
2218 pline("That's too insubstantial to tin.");
2219 return;
2220 }
2221 consume_obj_charge(obj, TRUE);
2222
2223 if ((can = mksobj(TIN, FALSE, FALSE)) != 0) {
2224 static const char you_buy_it[] = "You tin it, you bought it!";
2225
2226 can->corpsenm = corpse->corpsenm;
2227 can->cursed = obj->cursed;
2228 can->blessed = obj->blessed;
2229 can->owt = weight(can);
2230 can->known = 1;
2231 /* Mark tinned tins. No spinach allowed... */
2232 set_tin_variety(can, HOMEMADE_TIN);
2233 if (carried(corpse)) {

Callers 1

doapplyFunction · 0.85

Calls 15

YouFunction · 0.85
floorfoodFunction · 0.85
anFunction · 0.85
cxnameFunction · 0.85
poly_when_stonedFunction · 0.85
instapetrifyFunction · 0.85
revive_corpseFunction · 0.85
verbalizeFunction · 0.85
pline_TheFunction · 0.85
consume_obj_chargeFunction · 0.85
mksobjFunction · 0.85
weightFunction · 0.85

Tested by

no test coverage detected