… | |
… | |
911 | && !tmp->flag [FLAG_CURSED] |
911 | && !tmp->flag [FLAG_CURSED] |
912 | && !tmp->flag [FLAG_DAMNED]) |
912 | && !tmp->flag [FLAG_DAMNED]) |
913 | continue; |
913 | continue; |
914 | |
914 | |
915 | for (int i = 0; i < NUM_STATS; i++) |
915 | for (int i = 0; i < NUM_STATS; i++) |
916 | stat_sum [i] = stat_sum [i] + tmp->stats.stat (i); |
916 | stat_sum [i] += tmp->stats.stat (i); |
917 | |
917 | |
918 | if (digest_types [tmp->type]) |
918 | if (digest_types [tmp->type]) |
919 | { |
919 | { |
920 | contr->digestion += tmp->stats.food; |
920 | contr->digestion += tmp->stats.food; |
921 | contr->gen_hp += tmp->stats.hp; |
921 | contr->gen_hp += tmp->stats.hp; |
… | |
… | |
1174 | |
1174 | |
1175 | if (type == PLAYER) |
1175 | if (type == PLAYER) |
1176 | { |
1176 | { |
1177 | // clamp various player stats |
1177 | // clamp various player stats |
1178 | for (int i = 0; i < NUM_STATS; ++i) |
1178 | for (int i = 0; i < NUM_STATS; ++i) |
1179 | stats.stat (i) = clamp (stat_sum [i], MIN_STAT, MAX_STAT); |
1179 | stats.stat (i) = stat_sum [i]; |
|
|
1180 | |
|
|
1181 | check_stat_bounds (&stats); |
1180 | |
1182 | |
1181 | contr->digestion = clamp (contr->digestion, MIN_DIGESTION, MAX_DIGESTION); |
1183 | contr->digestion = clamp (contr->digestion, MIN_DIGESTION, MAX_DIGESTION); |
1182 | |
1184 | |
1183 | /* Figure out the players sp/mana/hp totals. */ |
1185 | /* Figure out the players sp/mana/hp totals. */ |
1184 | int pl_level; |
1186 | int pl_level; |
1185 | |
1187 | |
1186 | check_stat_bounds (&(stats)); |
|
|
1187 | pl_level = level; |
|
|
1188 | |
|
|
1189 | if (pl_level < 1) |
|
|
1190 | pl_level = 1; /* safety, we should always get 1 levels worth of hp! */ |
1188 | pl_level = max (1, level); /* safety, we should always get 1 levels worth of hp! */ |
1191 | |
1189 | |
1192 | /* You basically get half a con bonus/level. But we do take into account rounding, |
1190 | /* You basically get half a con bonus/level. But we do take into account rounding, |
1193 | * so if your bonus is 7, you still get 7 worth of bonus every 2 levels. |
1191 | * so if your bonus is 7, you still get 7 worth of bonus every 2 levels. |
1194 | */ |
1192 | */ |
1195 | stats.maxhp = 0; |
1193 | stats.maxhp = 0; |