| 1027 | } |
| 1028 | |
| 1029 | staticfn void |
| 1030 | peffect_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 | |
| 1051 | staticfn void |
| 1052 | peffect_speed(struct obj *otmp) |