add or subtract np points from random attributes, adjusting the base and maximum values of the attributes. if subtracting, np must be negative. returns the left over points. */
| 696 | if subtracting, np must be negative. |
| 697 | returns the left over points. */ |
| 698 | staticfn int |
| 699 | init_attr_role_redist(int np, boolean addition) |
| 700 | { |
| 701 | int tryct = 0; |
| 702 | int adj = addition ? 1 : -1; |
| 703 | |
| 704 | while ((addition ? (np > 0) : (np < 0)) && tryct < 100) { |
| 705 | int i = rnd_attr(); |
| 706 | |
| 707 | if (i >= A_MAX |
| 708 | || (addition ? (ABASE(i) >= ATTRMAX(i)) |
| 709 | : (ABASE(i) <= ATTRMIN(i)))) { |
| 710 | tryct++; |
| 711 | continue; |
| 712 | } |
| 713 | tryct = 0; |
| 714 | ABASE(i) += adj; |
| 715 | AMAX(i) += adj; |
| 716 | np -= adj; |
| 717 | } |
| 718 | return np; |
| 719 | } |
| 720 | |
| 721 | /* allocate hero's initial characteristics */ |
| 722 | void |