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

Function peffect_gain_energy

src/potion.c:1223–1257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1221}
1222
1223staticfn void
1224peffect_gain_energy(struct obj *otmp)
1225{
1226 int num;
1227
1228 if (otmp->cursed)
1229 You_feel("lackluster.");
1230 else
1231 pline("Magical energies course through your body.");
1232
1233 /* old: num = rnd(5) + 5 * otmp->blessed + 1;
1234 * blessed: +7..11 max & current (+9 avg)
1235 * uncursed: +2.. 6 max & current (+4 avg)
1236 * cursed: -2.. 6 max & current (-4 avg)
1237 * new: (3.6.0)
1238 * blessed: +3..18 max (+10.5 avg), +9..54 current (+31.5 avg)
1239 * uncursed: +2..12 max (+ 7 avg), +6..36 current (+21 avg)
1240 * cursed: -1.. 6 max (- 3.5 avg), -3..18 current (-10.5 avg)
1241 */
1242 num = d(otmp->blessed ? 3 : !otmp->cursed ? 2 : 1, 6);
1243 if (otmp->cursed)
1244 num = -num; /* subtract instead of add when cursed */
1245 u.uenmax += num;
1246 if (u.uenmax > u.uenpeak)
1247 u.uenpeak = u.uenmax;
1248 else if (u.uenmax <= 0)
1249 u.uenmax = 0;
1250 u.uen += 3 * num;
1251 if (u.uen > u.uenmax)
1252 u.uen = u.uenmax;
1253 else if (u.uen <= 0)
1254 u.uen = 0;
1255 disp.botl = TRUE;
1256 exercise(A_WIS, TRUE);
1257}
1258
1259staticfn void
1260peffect_oil(struct obj *otmp)

Callers 1

peffectsFunction · 0.85

Calls 4

You_feelFunction · 0.85
dFunction · 0.85
exerciseFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected