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

Function peffect_sickness

src/potion.c:963–1011  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

961}
962
963staticfn void
964peffect_sickness(struct obj *otmp)
965{
966 pline("Yecch! This stuff tastes like poison.");
967 if (otmp->blessed) {
968 pline("(But in fact it was mildly stale %s.)", fruitname(TRUE));
969 if (!Role_if(PM_HEALER)) {
970 /* NB: blessed otmp->fromsink is not possible */
971 losehp(1, "mildly contaminated potion", KILLED_BY_AN);
972 }
973 } else {
974 if (Poison_resistance)
975 pline("(But in fact it was biologically contaminated %s.)",
976 fruitname(TRUE));
977 if (Role_if(PM_HEALER)) {
978 pline("Fortunately, you have been immunized.");
979 } else {
980 char contaminant[BUFSZ];
981 int typ = rn2(A_MAX);
982
983 Sprintf(contaminant, "%s%s",
984 (Poison_resistance) ? "mildly " : "",
985 (otmp->fromsink) ? "contaminated tap water"
986 : "contaminated potion");
987 if (!Fixed_abil) {
988 poisontell(typ, FALSE);
989 (void) adjattrib(typ, Poison_resistance ? -1 : -rn1(4, 3),
990 1);
991 }
992 if (!Poison_resistance) {
993 if (otmp->fromsink)
994 losehp(rnd(10) + 5 * !!(otmp->cursed), contaminant,
995 KILLED_BY);
996 else
997 losehp(rnd(10) + 5 * !!(otmp->cursed), contaminant,
998 KILLED_BY_AN);
999 } else {
1000 /* rnd loss is so that unblessed poorer than blessed */
1001 losehp(1 + rn2(2), contaminant,
1002 (otmp->fromsink) ? KILLED_BY : KILLED_BY_AN);
1003 }
1004 exercise(A_CON, FALSE);
1005 }
1006 }
1007 if (Hallucination) {
1008 You("are shocked back to your senses!");
1009 (void) make_hallucinated(0L, FALSE, 0L);
1010 }
1011}
1012
1013staticfn void
1014peffect_confusion(struct obj *otmp)

Callers 1

peffectsFunction · 0.85

Calls 10

fruitnameFunction · 0.85
losehpFunction · 0.85
rn2Function · 0.85
poisontellFunction · 0.85
adjattribFunction · 0.85
rndFunction · 0.85
exerciseFunction · 0.85
YouFunction · 0.85
make_hallucinatedFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected