| 2681 | } |
| 2682 | |
| 2683 | void apply_exp() |
| 2684 | { |
| 2685 | const unsigned int exp_gained = you.experience_pool; |
| 2686 | if (exp_gained == 0) |
| 2687 | return; |
| 2688 | |
| 2689 | you.experience_pool = 0; |
| 2690 | |
| 2691 | // xp-gated effects that don't use sprint inflation |
| 2692 | _handle_xp_penance(exp_gained); |
| 2693 | _handle_god_wrath(exp_gained); |
| 2694 | |
| 2695 | // evolution mutation timer |
| 2696 | if (you.attribute[ATTR_EVOL_XP] > 0 && you.can_safely_mutate()) |
| 2697 | you.attribute[ATTR_EVOL_XP] -= exp_gained; |
| 2698 | |
| 2699 | // modified experience due to sprint inflation |
| 2700 | unsigned int skill_xp = exp_gained; |
| 2701 | if (crawl_state.game_is_sprint()) |
| 2702 | skill_xp = sprint_modify_exp(skill_xp); |
| 2703 | |
| 2704 | // xp-gated effects that use sprint inflation |
| 2705 | _recharge_xp_evokers(skill_xp); |
| 2706 | _reduce_abyss_xp_timer(skill_xp); |
| 2707 | _handle_hp_drain(skill_xp); |
| 2708 | _handle_banes(skill_xp); |
| 2709 | _handle_ostracism(skill_xp); |
| 2710 | _handle_breath_recharge(skill_xp); |
| 2711 | _handle_cacophony_recharge(skill_xp); |
| 2712 | _handle_batform_recharge(skill_xp); |
| 2713 | _handle_watery_grave_recharge(skill_xp); |
| 2714 | |
| 2715 | if (player_under_penance(GOD_HEPLIAKLQANA)) |
| 2716 | return; // no xp for you! |
| 2717 | |
| 2718 | // handle actual experience gains, |
| 2719 | // i.e. XL and skills |
| 2720 | |
| 2721 | dprf("gain_exp: %d", exp_gained); |
| 2722 | |
| 2723 | if (you.experience + exp_gained > (unsigned int)MAX_EXP_TOTAL) |
| 2724 | you.experience = MAX_EXP_TOTAL; |
| 2725 | else |
| 2726 | you.experience += exp_gained; |
| 2727 | |
| 2728 | you.exp_available += 10 * skill_xp; |
| 2729 | |
| 2730 | train_skills(); |
| 2731 | while (check_selected_skills() |
| 2732 | && you.exp_available >= calc_skill_cost(you.skill_cost_level)) |
| 2733 | { |
| 2734 | train_skills(); |
| 2735 | } |
| 2736 | |
| 2737 | level_change(); |
| 2738 | } |
| 2739 | |
| 2740 | bool will_gain_life(int lev) |
no test coverage detected