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

Function peffect_gain_ability

src/potion.c:1029–1049  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1027}
1028
1029staticfn void
1030peffect_gain_ability(struct obj *otmp)
1031{
1032 if (otmp->cursed) {
1033 pline("Ulch! That potion tasted foul!");
1034 gp.potion_unkn++;
1035 } else if (Fixed_abil) {
1036 gp.potion_nothing++;
1037 } else { /* If blessed, increase all; if not, try up to */
1038 int itmp; /* 6 times to find one which can be increased. */
1039 int ii, i = -1; /* increment to 0 */
1040 for (ii = A_MAX; ii > 0; ii--) {
1041 i = (otmp->blessed ? i + 1 : rn2(A_MAX));
1042 /* only give "your X is already as high as it can get"
1043 message on last attempt (except blessed potions) */
1044 itmp = (otmp->blessed || ii == 1) ? 0 : -1;
1045 if (adjattrib(i, 1, itmp) && !otmp->blessed)
1046 break;
1047 }
1048 }
1049}
1050
1051staticfn void
1052peffect_speed(struct obj *otmp)

Callers 1

peffectsFunction · 0.85

Calls 3

rn2Function · 0.85
adjattribFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected