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

Function choke

src/eat.c:244–288  ·  view source on GitHub ↗

Created by GAN 01/28/87 * Amended by AKP 09/22/87: if not hard, don't choke, just vomit. * Amended by 3. 06/12/89: if not hard, sometimes choke anyway, to keep risk. * 11/10/89: if hard, rarely vomit anyway, for slim chance. * * To a full belly all food is bad. (It.) */

Source from the content-addressed store, hash-verified

242 * To a full belly all food is bad. (It.)
243 */
244staticfn void
245choke(struct obj *food)
246{
247 /* only happens if you were satiated */
248 if (u.uhs != SATIATED) {
249 if (!food || food->otyp != AMULET_OF_STRANGULATION)
250 return;
251 } else if (Role_if(PM_KNIGHT) && u.ualign.type == A_LAWFUL) {
252 adjalign(-1); /* gluttony is unchivalrous */
253 You_feel("like a glutton!");
254 }
255
256 exercise(A_CON, FALSE);
257
258 if (Breathless || Hunger || (!Strangled && !rn2(20))) {
259 /* choking by eating AoS doesn't involve stuffing yourself */
260 if (food && food->otyp == AMULET_OF_STRANGULATION) {
261 You("choke, but recover your composure.");
262 return;
263 }
264 You("stuff yourself and then vomit voluminously.");
265 morehungry(Hunger ? (u.uhunger - 60) : 1000); /* just got very sick! */
266 vomit();
267 } else {
268 svk.killer.format = KILLED_BY_AN;
269 /*
270 * Note all "killer"s below read "Choked on %s" on the
271 * high score list & tombstone. So plan accordingly.
272 */
273 if (food) {
274 You("choke over your %s.", foodword(food));
275 if (food->oclass == COIN_CLASS) {
276 Strcpy(svk.killer.name, "very rich meal");
277 } else {
278 svk.killer.format = KILLED_BY;
279 Strcpy(svk.killer.name, killer_xname(food));
280 }
281 } else {
282 You("choke over it.");
283 Strcpy(svk.killer.name, "quick snack");
284 }
285 You("die...");
286 done(CHOKING);
287 }
288}
289
290/* modify victual.piece->owt depending on time spent consuming it */
291staticfn void

Callers 3

eataccessoryFunction · 0.85
biteFunction · 0.85
lesshungryFunction · 0.85

Calls 10

adjalignFunction · 0.85
You_feelFunction · 0.85
exerciseFunction · 0.85
rn2Function · 0.85
YouFunction · 0.85
morehungryFunction · 0.85
vomitFunction · 0.85
foodwordFunction · 0.85
killer_xnameFunction · 0.85
doneFunction · 0.85

Tested by

no test coverage detected