… | |
… | |
2557 | } |
2557 | } |
2558 | |
2558 | |
2559 | /* Digestion */ |
2559 | /* Digestion */ |
2560 | if (--op->last_eat < 0) |
2560 | if (--op->last_eat < 0) |
2561 | { |
2561 | { |
2562 | int bonus = op->contr->digestion > 0 ? op->contr->digestion : 0, penalty = op->contr->digestion < 0 ? -op->contr->digestion : 0; |
2562 | int bonus = max (0, op->contr->digestion), |
|
|
2563 | penalty = max (0, -op->contr->digestion); |
2563 | |
2564 | |
2564 | if (op->contr->gen_hp > 0) |
|
|
2565 | op->last_eat = 25 * (1 + bonus) / (op->contr->gen_hp + penalty + 1); |
2565 | op->last_eat = 25 * (1 + bonus) / (max (0, op->contr->gen_hp) + penalty + 1); |
2566 | else |
|
|
2567 | op->last_eat = 25 * (1 + bonus) / (penalty + 1); |
|
|
2568 | |
2566 | |
2569 | /* dms do not consume food */ |
2567 | /* dms do not consume food */ |
2570 | if (!QUERY_FLAG (op, FLAG_WIZ)) |
2568 | if (!QUERY_FLAG (op, FLAG_WIZ)) |
2571 | op->stats.food--; |
2569 | op->stats.food--; |
2572 | } |
2570 | } |