Esempio n. 1
0
void demigod_rechoose_powers(void)
{
    int i, idx;
    for (i = 0; i < MAX_DEMIGOD_POWERS; i++)
    {
        idx = p_ptr->demigod_power[i];
        if (idx >= 0)
        {
            mut_unlock(idx);
            mut_lose(idx);
            p_ptr->demigod_power[i] = -1;
        }
    }
    _gain_level(p_ptr->lev);
}
Esempio n. 2
0
void mimic_race(int new_race, const char *msg)
{
    int  old_race = p_ptr->mimic_form;

    if (p_ptr->prace != RACE_DOPPELGANGER) return;
    if (p_ptr->tim_mimic) return;
    if (new_race == old_race) return;

    if (msg)
        msg_print(msg);
    
    if (old_race == RACE_HUMAN || old_race == RACE_DEMIGOD)
    {
        int i, idx;
        for (i = 0; i < MAX_DEMIGOD_POWERS; i++)
        {
            idx = p_ptr->demigod_power[i];
            if (idx >= 0)
            {
                mut_unlock(idx);
                mut_lose(idx);
            /*    Lose the mutation, but not the choice!
                p_ptr->demigod_power[i] = -1; */
            }
        }
    }

    /* Shifting form causes mutations to vanish! */
    mut_lose_all();

    if (new_race == MIMIC_NONE)
        msg_print("You resume your true form.");
    else
    {
        race_t *race_ptr = get_race_t_aux(new_race, 0);
        if (is_a_vowel(race_ptr->name[0]))
            msg_format("You turn into an %s!", race_ptr->name);
        else
            msg_format("You turn into a %s!", race_ptr->name);
    }

    p_ptr->mimic_form = new_race;
    p_ptr->expfact = calc_exp_factor();
    check_experience();

    if (new_race == RACE_HUMAN || new_race == RACE_DEMIGOD)
    {
        get_race_t()->gain_level(p_ptr->lev);    /* This is OK ... Just make sure we get to choose racial powers on mimicry */
    }

    if (new_race == RACE_BEASTMAN)
    {
        int i;
        mut_gain_random(mut_good_pred);
        for (i = 2; i <= p_ptr->lev; i++)
        {
            if (one_in_(5))
                mut_gain_random(NULL);
        }
    }

    p_ptr->redraw |= (PR_BASIC | PR_STATUS | PR_MAP);
    p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA);

    equip_on_change_race();
    reset_visuals();
    handle_stuff();
}