… | |
… | |
232 | depl = present_arch_in_ob (at, op); |
232 | depl = present_arch_in_ob (at, op); |
233 | |
233 | |
234 | if (depl) |
234 | if (depl) |
235 | { |
235 | { |
236 | for (i = 0; i < NUM_STATS; i++) |
236 | for (i = 0; i < NUM_STATS; i++) |
237 | if (get_attr_value (&depl->stats, i)) |
237 | if (depl->stats.stat (i)) |
238 | new_draw_info (NDI_UNIQUE, 0, op, restore_msg[i]); |
238 | new_draw_info (NDI_UNIQUE, 0, op, restore_msg[i]); |
239 | |
239 | |
240 | depl->destroy (); |
240 | depl->destroy (); |
241 | op->update_stats (); |
241 | op->update_stats (); |
242 | } |
242 | } |
… | |
… | |
3659 | * Handles player eating food that temporarily changes status (resistances, stats). |
3659 | * Handles player eating food that temporarily changes status (resistances, stats). |
3660 | * This used to call cast_change_attr(), but |
3660 | * This used to call cast_change_attr(), but |
3661 | * that doesn't work with the new spell code. Since we know what |
3661 | * that doesn't work with the new spell code. Since we know what |
3662 | * the food changes, just grab a force and use that instead. |
3662 | * the food changes, just grab a force and use that instead. |
3663 | */ |
3663 | */ |
3664 | |
|
|
3665 | void |
3664 | void |
3666 | eat_special_food (object *who, object *food) |
3665 | eat_special_food (object *who, object *food) |
3667 | { |
3666 | { |
3668 | object *force; |
3667 | object *force; |
3669 | int i, did_one = 0; |
3668 | int i, did_one = 0; |
3670 | sint8 k; |
|
|
3671 | |
3669 | |
3672 | force = get_archetype (FORCE_NAME); |
3670 | force = get_archetype (FORCE_NAME); |
3673 | |
3671 | |
3674 | for (i = 0; i < NUM_STATS; i++) |
3672 | for (i = 0; i < NUM_STATS; i++) |
3675 | { |
3673 | if (sint8 k = food->stats.stat (i)) |
3676 | k = get_attr_value (&food->stats, i); |
|
|
3677 | if (k) |
|
|
3678 | { |
3674 | { |
3679 | set_attr_value (&force->stats, i, k); |
3675 | force->stats.stat (i) = k; |
3680 | did_one = 1; |
3676 | did_one = 1; |
3681 | } |
3677 | } |
3682 | } |
|
|
3683 | |
3678 | |
3684 | /* check if we can protect the eater */ |
3679 | /* check if we can protect the eater */ |
3685 | for (i = 0; i < NROFATTACKS; i++) |
3680 | for (i = 0; i < NROFATTACKS; i++) |
3686 | { |
3681 | { |
3687 | if (food->resist[i] > 0) |
3682 | if (food->resist[i] > 0) |
… | |
… | |
3880 | */ |
3875 | */ |
3881 | int i, j; |
3876 | int i, j; |
3882 | |
3877 | |
3883 | for (i = 0; i < NUM_STATS; i++) |
3878 | for (i = 0; i < NUM_STATS; i++) |
3884 | { |
3879 | { |
3885 | sint8 stat = get_attr_value (stats, i); |
|
|
3886 | int race_bonus = get_attr_value (&(pl->arch->clone.stats), i); |
3880 | int race_bonus = pl->arch->clone.stats.stat (i); |
|
|
3881 | sint8 stat = stats->stat (i) + ns->stat (i); |
3887 | |
3882 | |
3888 | stat += get_attr_value (ns, i); |
|
|
3889 | if (stat > 20 + race_bonus) |
3883 | if (stat > 20 + race_bonus) |
3890 | { |
3884 | { |
3891 | excess_stat++; |
3885 | excess_stat++; |
3892 | stat = 20 + race_bonus; |
3886 | stat = 20 + race_bonus; |
3893 | } |
3887 | } |
3894 | set_attr_value (stats, i, stat); |
3888 | |
|
|
3889 | stats->stat (i) = stat; |
3895 | } |
3890 | } |
3896 | |
3891 | |
3897 | for (j = 0; excess_stat > 0 && j < 100; j++) |
3892 | for (j = 0; excess_stat > 0 && j < 100; j++) |
3898 | { /* try 100 times to assign excess stats */ |
3893 | { /* try 100 times to assign excess stats */ |
3899 | int i = rndm (0, 6); |
3894 | int i = rndm (0, 6); |
3900 | int stat = get_attr_value (stats, i); |
|
|
3901 | int race_bonus = get_attr_value (&(pl->arch->clone.stats), i); |
|
|
3902 | |
3895 | |
3903 | if (i == CHA) |
3896 | if (i == CHA) |
3904 | continue; /* exclude cha from this */ |
3897 | continue; /* exclude cha from this */ |
|
|
3898 | |
|
|
3899 | int stat = stats->stat (i); |
|
|
3900 | int race_bonus = pl->arch->clone.stats.stat (i); |
3905 | if (stat < 20 + race_bonus) |
3901 | if (stat < 20 + race_bonus) |
3906 | { |
3902 | { |
3907 | change_attr_value (stats, i, 1); |
3903 | change_attr_value (stats, i, 1); |
3908 | excess_stat--; |
3904 | excess_stat--; |
3909 | } |
3905 | } |
… | |
… | |
3912 | /* insert the randomitems from the change's treasurelist into |
3908 | /* insert the randomitems from the change's treasurelist into |
3913 | * the player ref: player.c |
3909 | * the player ref: player.c |
3914 | */ |
3910 | */ |
3915 | if (change->randomitems != NULL) |
3911 | if (change->randomitems != NULL) |
3916 | give_initial_items (pl, change->randomitems); |
3912 | give_initial_items (pl, change->randomitems); |
3917 | |
|
|
3918 | |
3913 | |
3919 | /* set up the face, for some races. */ |
3914 | /* set up the face, for some races. */ |
3920 | |
3915 | |
3921 | /* first, look for the force object banning |
3916 | /* first, look for the force object banning |
3922 | * changing the face. Certain races never change face with class. |
3917 | * changing the face. Certain races never change face with class. |