예제 #1
0
void magic_eater_cast(int tval)
{
    int chance;
    _spell_t *spell;

    /* Duplicate anti-magic checks since "device" commands might re-route here (as "magic" commands)
       For example, do_cmd_use_staff() will allow magic-eaters to invoke staff based spells. */
    if (dun_level && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC))
    {
        msg_print("The dungeon absorbs all attempted magic!");
        return;
    }
    else if (p_ptr->tim_no_spells)
    {
        msg_print("Your spells are blocked!");
        return;
    }
    else if (p_ptr->anti_magic)
    {
        msg_print("An anti-magic shell disrupts your magic!");
        return;
    }
    else if (IS_SHERO())
    {
        msg_print("You cannot think clearly!");
        return;
    }

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

    spell = _prompt(tval);
    if (!spell)
        return;
    if (!_calc_charges(spell))
    {
        msg_print("You are out of charges!");
        return;
    }

    energy_use = 100;
    chance = _calc_fail_rate(spell);
    if (randint0(100) < chance)
    {
        if (flush_failure) flush();
        msg_format("You failed to get the magic off!");
        sound(SOUND_FAIL);
        if (randint1(100) >= chance)
            virtue_add(VIRTUE_CHANCE,-1);
        return;
    }
    else
    {
        if (_do_device(spell->kind.tval, spell->kind.sval, SPELL_CAST)) 
            _use_charge(spell);
        else
            energy_use = 0;
    }
}
예제 #2
0
void _wild_berserk_on(void) {
    if (!IS_SHERO())
        msg_print("You feel like a killing machine!");
}
예제 #3
0
void _wild_berserk_off(void) {
    if (p_ptr->shero)
        set_shero(0, TRUE);
    if (!IS_SHERO())
        msg_print("You feel less Berserk.");
}
static bool _necro_do_touch(int type, int dice, int sides, int base)
{
    int x, y;
    int dir = 0;
    int m_idx = 0;

    if (!_necro_check_touch()) return FALSE;

    /* For ergonomics sake, use currently targeted monster. This allows
       a macro of \e*tmaa or similar to pick an adjacent foe, while
       \emaa*t won't work, since get_rep_dir2() won't allow a target. */
    if (use_old_target && target_okay())
    {
        y = target_row;
        x = target_col;
        m_idx = cave[y][x].m_idx;
        if (m_idx)
        {
            if (m_list[m_idx].cdis > 1)
                m_idx = 0;
            else
                dir = 5; /* Hack so that fire_ball() works correctly */
        }
    }

    if (!m_idx)
    {
        if (!get_rep_dir2(&dir)) return FALSE;
        if (dir == 5) return FALSE;

        y = py + ddy[dir];
        x = px + ddx[dir];
        m_idx = cave[y][x].m_idx;

        if (!m_idx)
        {
            msg_print("There is no monster there.");
            return FALSE;
        }

    }

    if (m_idx)
    {
        int dam;
        monster_type *m_ptr = &m_list[m_idx];

        if (!is_hostile(m_ptr) &&
            !(p_ptr->stun || p_ptr->confused || p_ptr->image ||
            IS_SHERO() || !m_ptr->ml))
        {
            if (!get_check("Really hit it? "))
                return FALSE;
        }

        dam = _necro_damroll(dice, sides, base);
        on_p_hit_m(m_idx);
        touch_zap_player(m_idx);
        if (fire_ball(type, dir, dam, 0))
        {
            if (type == GF_OLD_DRAIN)
                hp_player(dam);
        }
    }
    return TRUE;
}