… | |
… | |
242 | change_attr_value (living *stats, int attr, sint8 value) |
242 | change_attr_value (living *stats, int attr, sint8 value) |
243 | { |
243 | { |
244 | stats->stat (attr) += value; |
244 | stats->stat (attr) += value; |
245 | } |
245 | } |
246 | |
246 | |
247 | sint8 & |
|
|
248 | living::stat (int index) |
|
|
249 | { |
|
|
250 | switch (index) |
|
|
251 | { |
|
|
252 | case STR: return Str; |
|
|
253 | case DEX: return Dex; |
|
|
254 | case CON: return Con; |
|
|
255 | case INT: return Int; |
|
|
256 | case WIS: return Wis; |
|
|
257 | case POW: return Pow; |
|
|
258 | case CHA: return Cha; |
|
|
259 | } |
|
|
260 | |
|
|
261 | LOG (llevError | logBacktrace, "living.stat() called with out-of-range stat index"); |
|
|
262 | static sint8 dummy; |
|
|
263 | return dummy; |
|
|
264 | } |
|
|
265 | |
|
|
266 | sint8 |
|
|
267 | living::stat (int index) const |
|
|
268 | { |
|
|
269 | switch (index) |
|
|
270 | { |
|
|
271 | case STR: return Str; |
|
|
272 | case DEX: return Dex; |
|
|
273 | case CON: return Con; |
|
|
274 | case INT: return Int; |
|
|
275 | case WIS: return Wis; |
|
|
276 | case POW: return Pow; |
|
|
277 | case CHA: return Cha; |
|
|
278 | } |
|
|
279 | |
|
|
280 | LOG (llevError | logBacktrace, "living.stat() called with out-of-range stat index"); |
|
|
281 | static sint8 dummy; |
|
|
282 | return dummy; |
|
|
283 | } |
|
|
284 | |
|
|
285 | /* |
247 | /* |
286 | * Ensures that all stats (str/dex/con/wis/cha/int) are within the |
248 | * Ensures that all stats (str/dex/con/wis/cha/int) are within the |
287 | * 1-30 stat limit. |
249 | * 1-30 stat limit. |
288 | */ |
250 | */ |
289 | void |
251 | void |
… | |
… | |
977 | vuln[i] += ((100 - vuln[i]) * -tmp->resist[i]) / 100; |
939 | vuln[i] += ((100 - vuln[i]) * -tmp->resist[i]) / 100; |
978 | } |
940 | } |
979 | } |
941 | } |
980 | |
942 | |
981 | /* There may be other things that should not adjust the attacktype */ |
943 | /* There may be other things that should not adjust the attacktype */ |
982 | if ((tmp->type != WEAPON && tmp->type != BOW && tmp->type != SYMPTOM) |
944 | if (tmp->type != SYMPTOM) |
983 | || current_weapon == tmp) |
|
|
984 | { |
945 | { |
985 | attacktype |= tmp->attacktype; |
946 | attacktype |= tmp->attacktype; |
986 | path_attuned |= tmp->path_attuned; |
947 | path_attuned |= tmp->path_attuned; |
987 | path_repelled |= tmp->path_repelled; |
948 | path_repelled |= tmp->path_repelled; |
988 | path_denied |= tmp->path_denied; |
949 | path_denied |= tmp->path_denied; |