… | |
… | |
2419 | { |
2419 | { |
2420 | gen_grace = op->stats.maxgrace; |
2420 | gen_grace = op->stats.maxgrace; |
2421 | rate_grace -= rate_grace / 2 * op->contr->gen_grace; |
2421 | rate_grace -= rate_grace / 2 * op->contr->gen_grace; |
2422 | } |
2422 | } |
2423 | |
2423 | |
2424 | /* Regenerate Spell Points */ |
|
|
2425 | if (!op->contr->golem && --op->last_sp < 0) |
|
|
2426 | { |
|
|
2427 | gen_sp = gen_sp * 10 / (op->contr->gen_sp_armour < 10 ? 10 : op->contr->gen_sp_armour); |
|
|
2428 | if (op->stats.sp < op->stats.maxsp) |
|
|
2429 | { |
|
|
2430 | op->stats.sp++; |
|
|
2431 | /* dms do not consume food */ |
|
|
2432 | if (!QUERY_FLAG (op, FLAG_WIZ)) |
|
|
2433 | { |
|
|
2434 | op->stats.food--; |
|
|
2435 | if (op->contr->digestion < 0) |
|
|
2436 | op->stats.food += op->contr->digestion; |
|
|
2437 | else if (op->contr->digestion > 0 && random_roll (0, op->contr->digestion, op, PREFER_HIGH)) |
|
|
2438 | op->stats.food = last_food; |
|
|
2439 | } |
|
|
2440 | } |
|
|
2441 | |
|
|
2442 | if (max_sp > 1) |
|
|
2443 | { |
|
|
2444 | over_sp = (gen_sp + 10) / rate_sp; |
|
|
2445 | if (over_sp > 0) |
|
|
2446 | { |
|
|
2447 | if (op->stats.sp < op->stats.maxsp) |
|
|
2448 | { |
|
|
2449 | op->stats.sp += over_sp > max_sp ? max_sp : over_sp; |
|
|
2450 | |
|
|
2451 | if (random_roll (0, rate_sp - 1, op, PREFER_LOW) > ((gen_sp + 10) % rate_sp)) |
|
|
2452 | op->stats.sp--; |
|
|
2453 | |
|
|
2454 | if (op->stats.sp > op->stats.maxsp) |
|
|
2455 | op->stats.sp = op->stats.maxsp; |
|
|
2456 | } |
|
|
2457 | op->last_sp = 0; |
|
|
2458 | } |
|
|
2459 | else |
|
|
2460 | op->last_sp = rate_sp / (gen_sp < 20 ? 30 : gen_sp + 10); |
|
|
2461 | } |
|
|
2462 | else |
|
|
2463 | op->last_sp = rate_sp / (gen_sp < 20 ? 30 : gen_sp + 10); |
|
|
2464 | } |
|
|
2465 | |
|
|
2466 | /* Regenerate Grace */ |
2424 | /* Regenerate Grace */ |
2467 | /* I altered this a little - maximum grace is ony achieved through prayer -b.t. */ |
2425 | /* I altered this a little - maximum grace is ony achieved through prayer -b.t. */ |
2468 | if (--op->last_grace < 0) |
2426 | if (--op->last_grace < 0) |
2469 | { |
2427 | { |
2470 | if (op->stats.grace < op->stats.maxgrace / 2) |
2428 | if (op->stats.grace < op->stats.maxgrace / 2) |
… | |
… | |
2489 | op->last_grace = rate_grace / (gen_grace < 20 ? 30 : gen_grace + 10); |
2447 | op->last_grace = rate_grace / (gen_grace < 20 ? 30 : gen_grace + 10); |
2490 | } |
2448 | } |
2491 | /* wearing stuff doesn't detract from grace generation. */ |
2449 | /* wearing stuff doesn't detract from grace generation. */ |
2492 | } |
2450 | } |
2493 | |
2451 | |
|
|
2452 | if (op->stats.food > 0) |
|
|
2453 | { |
2494 | /* Regenerate Hit Points */ |
2454 | /* Regenerate Spell Points */ |
2495 | if (--op->last_heal < 0) |
2455 | if (!op->contr->golem && --op->last_sp < 0) |
2496 | { |
|
|
2497 | if (op->stats.hp < op->stats.maxhp) |
|
|
2498 | { |
2456 | { |
2499 | op->stats.hp++; |
2457 | gen_sp = gen_sp * 10 / (op->contr->gen_sp_armour < 10 ? 10 : op->contr->gen_sp_armour); |
2500 | /* dms do not consume food */ |
2458 | |
2501 | if (!QUERY_FLAG (op, FLAG_WIZ)) |
2459 | if (op->stats.sp < op->stats.maxsp) |
2502 | { |
2460 | { |
|
|
2461 | op->stats.sp++; |
|
|
2462 | |
|
|
2463 | /* dms do not consume food */ |
|
|
2464 | if (!QUERY_FLAG (op, FLAG_WIZ)) |
|
|
2465 | { |
2503 | op->stats.food--; |
2466 | op->stats.food--; |
|
|
2467 | |
2504 | if (op->contr->digestion < 0) |
2468 | if (op->contr->digestion < 0) |
2505 | op->stats.food += op->contr->digestion; |
2469 | op->stats.food += op->contr->digestion; |
2506 | else if (op->contr->digestion > 0 && random_roll (0, op->contr->digestion, op, PREFER_HIGH)) |
2470 | else if (op->contr->digestion > 0 && random_roll (0, op->contr->digestion, op, PREFER_HIGH)) |
2507 | op->stats.food = last_food; |
2471 | op->stats.food = last_food; |
|
|
2472 | } |
2508 | } |
2473 | } |
2509 | } |
|
|
2510 | |
2474 | |
2511 | if (max_hp > 1) |
2475 | if (max_sp > 1) |
2512 | { |
|
|
2513 | over_hp = (gen_hp < 20 ? 30 : gen_hp + 10) / rate_hp; |
|
|
2514 | if (over_hp > 0) |
|
|
2515 | { |
2476 | { |
2516 | op->stats.sp += over_hp + (RANDOM () % rate_hp > ((gen_hp < 20 ? 30 : gen_hp + 10) % rate_hp)) ? -1 : 0; |
2477 | over_sp = (gen_sp + 10) / rate_sp; |
|
|
2478 | if (over_sp > 0) |
|
|
2479 | { |
|
|
2480 | if (op->stats.sp < op->stats.maxsp) |
|
|
2481 | { |
|
|
2482 | op->stats.sp += over_sp > max_sp ? max_sp : over_sp; |
|
|
2483 | |
|
|
2484 | if (random_roll (0, rate_sp - 1, op, PREFER_LOW) > ((gen_sp + 10) % rate_sp)) |
|
|
2485 | op->stats.sp--; |
|
|
2486 | |
|
|
2487 | if (op->stats.sp > op->stats.maxsp) |
|
|
2488 | op->stats.sp = op->stats.maxsp; |
|
|
2489 | } |
|
|
2490 | |
2517 | op->last_heal = 0; |
2491 | op->last_sp = 0; |
|
|
2492 | } |
|
|
2493 | else |
|
|
2494 | op->last_sp = rate_sp / (gen_sp < 20 ? 30 : gen_sp + 10); |
2518 | } |
2495 | } |
2519 | else |
2496 | else |
|
|
2497 | op->last_sp = rate_sp / (gen_sp < 20 ? 30 : gen_sp + 10); |
|
|
2498 | } |
|
|
2499 | |
|
|
2500 | /* Regenerate Hit Points */ |
|
|
2501 | if (--op->last_heal < 0) |
|
|
2502 | { |
|
|
2503 | if (op->stats.hp < op->stats.maxhp) |
2520 | { |
2504 | { |
2521 | op->last_heal = rate_hp / (gen_hp < 20 ? 30 : gen_hp + 10); |
2505 | op->stats.hp++; |
|
|
2506 | |
|
|
2507 | /* dms do not consume food */ |
|
|
2508 | if (!QUERY_FLAG (op, FLAG_WIZ)) |
|
|
2509 | { |
|
|
2510 | op->stats.food--; |
|
|
2511 | |
|
|
2512 | if (op->contr->digestion < 0) |
|
|
2513 | op->stats.food += op->contr->digestion; |
|
|
2514 | else if (op->contr->digestion > 0 && random_roll (0, op->contr->digestion, op, PREFER_HIGH)) |
|
|
2515 | op->stats.food = last_food; |
|
|
2516 | } |
2522 | } |
2517 | } |
|
|
2518 | |
|
|
2519 | if (max_hp > 1) |
|
|
2520 | { |
|
|
2521 | over_hp = (gen_hp < 20 ? 30 : gen_hp + 10) / rate_hp; |
|
|
2522 | |
|
|
2523 | if (over_hp > 0) |
|
|
2524 | { |
|
|
2525 | op->stats.sp += over_hp + (RANDOM () % rate_hp > ((gen_hp < 20 ? 30 : gen_hp + 10) % rate_hp)) ? -1 : 0; |
|
|
2526 | op->last_heal = 0; |
|
|
2527 | } |
|
|
2528 | else |
|
|
2529 | op->last_heal = rate_hp / (gen_hp < 20 ? 30 : gen_hp + 10); |
2523 | } |
2530 | } |
2524 | else |
2531 | else |
2525 | { |
|
|
2526 | op->last_heal = rate_hp / (gen_hp < 20 ? 30 : gen_hp + 10); |
2532 | op->last_heal = rate_hp / (gen_hp < 20 ? 30 : gen_hp + 10); |
2527 | } |
2533 | } |
2528 | } |
2534 | } |
2529 | |
2535 | |
2530 | /* Digestion */ |
2536 | /* Digestion */ |
2531 | if (--op->last_eat < 0) |
2537 | if (--op->last_eat < 0) |
… | |
… | |
2568 | new_draw_info (NDI_UNIQUE, 0, op, "You blindly grab for a bite of food."); |
2574 | new_draw_info (NDI_UNIQUE, 0, op, "You blindly grab for a bite of food."); |
2569 | manual_apply (op, flesh, 0); |
2575 | manual_apply (op, flesh, 0); |
2570 | } |
2576 | } |
2571 | } |
2577 | } |
2572 | |
2578 | |
2573 | while (op->stats.food < 0 && op->stats.hp >= 0) |
2579 | if (op->stats.food < 0) |
2574 | op->stats.food++, op->stats.hp--; |
2580 | { |
|
|
2581 | op->stats.hp += op->stats.food; |
|
|
2582 | op->stats.food = 0; |
|
|
2583 | } |
2575 | |
2584 | |
2576 | if (op->stats.hp < 0 && !QUERY_FLAG (op, FLAG_WIZ)) |
2585 | if (op->stats.hp < 0 && !QUERY_FLAG (op, FLAG_WIZ)) |
2577 | kill_player (op); |
2586 | kill_player (op); |
2578 | } |
2587 | } |
2579 | } |
2588 | } |