calculate spell power/energy points for new level */
| 42 | |
| 43 | /* calculate spell power/energy points for new level */ |
| 44 | int |
| 45 | newpw(void) |
| 46 | { |
| 47 | int en = 0, enrnd, enfix; |
| 48 | |
| 49 | if (u.ulevel == 0) { |
| 50 | en = gu.urole.enadv.infix + gu.urace.enadv.infix; |
| 51 | if (gu.urole.enadv.inrnd > 0) |
| 52 | en += rnd(gu.urole.enadv.inrnd); |
| 53 | if (gu.urace.enadv.inrnd > 0) |
| 54 | en += rnd(gu.urace.enadv.inrnd); |
| 55 | } else { |
| 56 | enrnd = (int) ACURR(A_WIS) / 2; |
| 57 | if (u.ulevel < gu.urole.xlev) { |
| 58 | enrnd += gu.urole.enadv.lornd + gu.urace.enadv.lornd; |
| 59 | enfix = gu.urole.enadv.lofix + gu.urace.enadv.lofix; |
| 60 | } else { |
| 61 | enrnd += gu.urole.enadv.hirnd + gu.urace.enadv.hirnd; |
| 62 | enfix = gu.urole.enadv.hifix + gu.urace.enadv.hifix; |
| 63 | } |
| 64 | en = enermod(rn1(enrnd, enfix)); |
| 65 | } |
| 66 | if (en <= 0) |
| 67 | en = 1; |
| 68 | if (u.ulevel < MAXULEV) { |
| 69 | /* remember increment; future level drain could take it away again */ |
| 70 | u.ueninc[u.ulevel] = (xint16) en; |
| 71 | } else { |
| 72 | /* after level 30, throttle energy gains from extra experience; |
| 73 | once max reaches 600, further increments will be just 1 more */ |
| 74 | char lim = 4 - u.uenmax / 200; |
| 75 | |
| 76 | lim = max(lim, 1); |
| 77 | if (en > lim) |
| 78 | en = lim; |
| 79 | } |
| 80 | return en; |
| 81 | } |
| 82 | |
| 83 | /* return # of exp points for mtmp after nk killed */ |
| 84 | int |
no test coverage detected