Esempio n. 1
0
void skills_on_birth(void)
{
    int i, j;
    int class_idx = _class_idx();
    for (i = 0; i < 5; i++)
    {
        for (j = 0; j < 64; j++)
        {
            if (i == TV_BOW-TV_WEAPON_BEGIN && demigod_is_(DEMIGOD_ARTEMIS))
                p_ptr->weapon_exp[i][j] = WEAPON_EXP_BEGINNER;
            else if (demigod_is_(DEMIGOD_ARES))
                p_ptr->weapon_exp[i][j] = WEAPON_EXP_BEGINNER;
            else
                p_ptr->weapon_exp[i][j] = s_info[class_idx].w_start[i][j];
        }
    }
    if (p_ptr->personality == PERS_SEXY)
        p_ptr->weapon_exp[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = MAX(WEAPON_EXP_BEGINNER, p_ptr->weapon_exp[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP]);
    for (i = 0; i < 10; i++)
        p_ptr->skill_exp[i] = s_info[class_idx].s_start[i];

    if (warlock_is_(WARLOCK_DRAGONS))
        p_ptr->skill_exp[SKILL_RIDING] = RIDING_EXP_BEGINNER;

    str_map_clear(_innate_map());
}
Esempio n. 2
0
void gray_mage_cast_spell(void)
{
    _slot_info_ptr slot_ptr;

    /* Blind is OK!!! */

    if (p_ptr->confused)
    {
        msg_print("You are too confused!");
        return;
    }

    slot_ptr = _choose("Cast", _ALLOW_EXCHANGE | _SHOW_INFO);
    if (slot_ptr)
    {
        magic_type *spell_ptr = _get_spell_info(slot_ptr->realm, slot_ptr->spell);
        int         cost = calculate_cost(spell_ptr->smana);
        int         fail = calculate_fail_rate(spell_ptr->slevel, spell_ptr->sfail, p_ptr->stat_ind[A_INT]);

        if (spell_ptr->slevel > p_ptr->lev) /* Experience Drain? */
        {
            msg_format("You need to be level %d to use that spell.", spell_ptr->slevel);
            return;
        }

        if (cost > p_ptr->csp)
        {
            msg_print("You do not have enough mana to cast this spell.");
            return;
        }

        p_ptr->csp -= cost;
        energy_use = 100;

        if (randint0(100) < fail)
        {
            if (flush_failure) flush();

            cmsg_format(TERM_VIOLET, "You failed to cast %s!", do_spell(slot_ptr->realm, slot_ptr->spell, SPELL_NAME));
            if (demigod_is_(DEMIGOD_ATHENA))
                p_ptr->csp += cost/2;
            spell_stats_on_fail_old(slot_ptr->realm, slot_ptr->spell);
            sound(SOUND_FAIL);
            do_spell(slot_ptr->realm, slot_ptr->spell, SPELL_FAIL);
        }
        else
        {
            if (!do_spell(slot_ptr->realm, slot_ptr->spell, SPELL_CAST))
            {  /* Canceled */
                p_ptr->csp += cost;
                energy_use = 0;
                return;
            }
            sound(SOUND_ZAP);
            spell_stats_on_cast_old(slot_ptr->realm, slot_ptr->spell);
        }
    }
    p_ptr->redraw |= PR_MANA;
    p_ptr->window |= PW_SPELL;
}
Esempio n. 3
0
int skills_bow_max(int sval)
{
    if (mut_present(MUT_WEAPON_SKILLS))
        return WEAPON_EXP_MASTER;

    if (demigod_is_(DEMIGOD_ARTEMIS))
        return WEAPON_EXP_MASTER;

    return s_info[_class_idx()].w_max[0][sval];
}
Esempio n. 4
0
void do_cmd_spell(void)
{
    spell_info spells[MAX_SPELLS];
    caster_info *caster = get_caster_info();
    int ct = 0; 
    int choice = 0;
    int max_cost = 0;

    if (!caster) 
    {
        msg_print("You cannot cast spells.");
        return;
    }
    
    if (p_ptr->confused)
    {
        msg_print("You are too confused!");
        return;
    }

    if (p_ptr->special_defense & KATA_MASK)
    {
        set_action(ACTION_NONE);
    }
    
    ct = _get_spell_table(spells, MAX_SPELLS);
    if (ct == 0)
    {
        /* User probably canceled the prompt for a spellbook */
        return;
    }

    if (caster->options & CASTER_USE_HP)
        max_cost = p_ptr->chp;
    else
        max_cost = p_ptr->csp;
    choice = choose_spell(spells, ct, caster->magic_desc, max_cost);

    if (choice >= 0 && choice < ct)
    {
        spell_info *spell = &spells[choice];

        if (spell->level > p_ptr->lev)
        {
            msg_print("You can't use that spell yet!");
            return;
        }

        /* Verify Cost ... Note, I'm removing options for over exertion 
           Also note we now pay casting costs up front for mana casters. 
           If the user cancels, then we return the cost below.
        */
        if (caster->options & CASTER_USE_HP)
        {
            if (spell->cost > p_ptr->chp)
            {
                msg_print("You do not have enough hp to use this power.");
                return;
            }
        }
        else
        {
            if (spell->cost > p_ptr->csp)
            {
                msg_print("You do not have enough mana to use this power.");
                return;
            }
            p_ptr->csp -= spell->cost;
        }

        /* Check for Failure */
        if (randint0(100) < spell->fail)
        {
            sound(SOUND_FAIL); /* Doh! */
            spell_stats_on_fail(spell);
            fail_spell(spell->fn);
            if (flush_failure) flush();
            msg_print("You failed to concentrate hard enough!");
            if (!(caster->options & CASTER_USE_HP) && demigod_is_(DEMIGOD_ATHENA) )
                p_ptr->csp += spell->cost/2;
            if (caster->on_fail != NULL)
                (caster->on_fail)(spell);
        }
        else
        {
            if (!cast_spell(spell->fn))
            {
                /* Give back the spell cost, since the user canceled the spell */
                if (!(caster->options & CASTER_USE_HP)) p_ptr->csp += spell->cost;
                return;
            }
            spell_stats_on_cast(spell);
            sound(SOUND_ZAP); /* Wahoo! */
        }

        energy_use = get_spell_energy(spell->fn);

        if ((caster->options & CASTER_USE_HP) && spell->cost > 0)
            take_hit(DAMAGE_USELIFE, spell->cost, "concentrating too hard", -1);

        if (caster->on_cast != NULL)
            (caster->on_cast)(spell);

        p_ptr->redraw |= (PR_MANA);
        p_ptr->redraw |= (PR_HP);
        p_ptr->window |= (PW_SPELL);
    }
}