void android_ray_gun_spell(int cmd, variant *res)
{
    switch (cmd)
    {
    case SPELL_NAME:
        var_set_string(res, "Ray Gun");
        break;
    case SPELL_DESC:
        var_set_string(res, "Fires unresistable damage at chosen foe.");
        break;
    case SPELL_INFO:
        var_set_string(res, info_damage(0, 0, spell_power(5 + (p_ptr->lev+1) / 2)));
        break;
    case SPELL_CAST:
    {
        int dir = 0;
        var_set_bool(res, FALSE);
        if (!get_aim_dir(&dir)) return;
        
        msg_print("You fire your ray gun.");
        fire_bolt(GF_MISSILE, dir, spell_power(5 + (p_ptr->lev+1) / 2));
        
        var_set_bool(res, TRUE);
        break;
    }
    default:
        default_spell(cmd, res);
        break;
    }
}
void android_blaster_spell(int cmd, variant *res)
{
    switch (cmd)
    {
    case SPELL_NAME:
        var_set_string(res, "Blaster");
        break;
    case SPELL_DESC:
        var_set_string(res, "");
        break;
    case SPELL_INFO:
        var_set_string(res, info_damage(0, 0, spell_power(5 + p_ptr->lev)));
        break;
    case SPELL_CAST:
    {
        int dir = 0;
        var_set_bool(res, FALSE);
        if (!get_aim_dir(&dir)) return;

        msg_print("You fire your blaster.");
        fire_bolt(GF_MISSILE, dir, spell_power(5 + p_ptr->lev));

        var_set_bool(res, TRUE);
        break;
    }
    default:
        default_spell(cmd, res);
        break;
    }
}
static void _shard_bolt_spell(int cmd, variant *res)
{
    int dd = 1 + p_ptr->lev / 3;
    int ds = 8;

    switch (cmd)
    {
    case SPELL_NAME:
        var_set_string(res, "Shard Bolt");
        break;
    case SPELL_DESC:
        var_set_string(res, "Fires a bolt of shards at chosen target.");
        break;
    case SPELL_INFO:
        var_set_string(res, info_damage(dd, ds, 0));
        break;
    case SPELL_CAST:
    {
        int dir = 0;
        var_set_bool(res, FALSE);
        if (!get_aim_dir(&dir)) return;
        fire_bolt(GF_SHARDS, dir, damroll(dd, ds));
        var_set_bool(res, TRUE);
        break;
    }
    default:
        default_spell(cmd, res);
        break;
    }
}
void ice_bolt_spell(int cmd, variant *res)
{
    int dd = 5 + p_ptr->lev / 4;
    int ds = 15;

    switch (cmd)
    {
    case SPELL_NAME:
        var_set_string(res, "Ice Bolt");
        break;
    case SPELL_DESC:
        var_set_string(res, "Fires a bolt of ice.");
        break;
    case SPELL_INFO:
        var_set_string(res, info_damage(dd, spell_power(ds), 0));
        break;
    case SPELL_CAST:
    {
        int dir = 0;
        var_set_bool(res, FALSE);
        if (!get_aim_dir(&dir)) return;
        fire_bolt(GF_ICE, dir, spell_power(damroll(dd, ds)));
        var_set_bool(res, TRUE);
        break;
    }
    default:
        default_spell(cmd, res);
        break;
    }
}
Example #5
0
void _shoot_spell(int cmd, variant *res)
{
    switch (cmd)
    {
    case SPELL_NAME:
        var_set_string(res, "Shoot");
        break;
    case SPELL_DESC:
        var_set_string(res, "Shoot a missile at chosen target.");
        break;
    case SPELL_INFO:
        var_set_string(res, info_damage(15, 15, 0));
        break;
    case SPELL_CAST:
    {
        int dir = 0;
        var_set_bool(res, FALSE);
        if (!get_aim_dir(&dir)) return;
        msg_print("You shoot a missile.");
        fire_bolt(GF_MISSILE, dir, damroll(15, 15));
        var_set_bool(res, TRUE);
        break;
    }
    default:
        default_spell(cmd, res);
        break;
    }
}
/*
 * Cast a bolt or a beam spell
 */
bool fire_bolt_or_beam(int prob, int typ, int dir, int dam)
{
    if (rand_int(100) < prob)
    {
        return (fire_beam(typ, dir, dam, 0L));
    }
    else
    {
        return (fire_bolt(typ, dir, dam));
    }
}
void imp_fire_spell(int cmd, variant *res)
{
    const int ball_lev = 30;
    switch (cmd)
    {
    case SPELL_NAME:
        if (p_ptr->lev >= ball_lev)
            var_set_string(res, "Fire Ball");
        else
            var_set_string(res, "Fire Bolt");
        break;
    case SPELL_SPOIL_NAME:
        var_set_string(res, "Fire Bolt/Ball");
        break;
    case SPELL_DESC:
        if (p_ptr->lev >= ball_lev)
            var_set_string(res, "Generate a Fire Ball on chosen target.");
        else
            var_set_string(res, "Hurls a fiery missile at chosen target.");
        break;
    case SPELL_SPOIL_DESC:
        var_set_string(res, "Fire Bolt for L damage. At L30, does a radius 2 Fire Ball for 2L damage instead.");
        break;
    case SPELL_INFO:
        if (p_ptr->lev >= ball_lev)
            var_set_string(res, info_damage(0, 0, spell_power(p_ptr->lev * 2)));
        else
            var_set_string(res, info_damage(0, 0, spell_power(p_ptr->lev)));
        break;
    case SPELL_CAST:
    {
        int dir = 0;
        var_set_bool(res, FALSE);
        if (!get_aim_dir(&dir)) return;
        if (p_ptr->lev >= ball_lev)
            fire_ball(GF_FIRE, dir, spell_power(p_ptr->lev * 2), 2);
        else
            fire_bolt(GF_FIRE, dir, spell_power(p_ptr->lev));
        var_set_bool(res, TRUE);
        break;
    }
    case SPELL_COST_EXTRA:
        if (p_ptr->lev >= ball_lev)
            var_set_int(res, 7);
        else
            var_set_int(res, 0);
        break;
    default:
        default_spell(cmd, res);
        break;
    }
}
static void _drip_of_light_spell(int cmd, variant *res)
{
    int  dd = 3 + (p_ptr->lev-1)/5;
    int     ds = 4;
    bool beam = (p_ptr->lev >= 10 && _on_mirror) ? TRUE : FALSE;

    switch (cmd)
    {
    case SPELL_NAME:
        var_set_string(res, "Drip of Light");
        break;
    case SPELL_DESC:
        if (beam)
            var_set_string(res, "Fires a beam of light");
        else
            var_set_string(res, "Fires a bolt of light");
        break;
    case SPELL_INFO:
        var_set_string(res, info_damage(spell_power(dd), ds, 0));
        break;
    case SPELL_CAST:
    {
        int dir;
        var_set_bool(res, FALSE);
        if (!get_aim_dir(&dir)) return;
        if (beam)
            fire_beam(GF_LITE, dir,spell_power(damroll(dd, ds)));
        else
            fire_bolt(GF_LITE, dir,spell_power(damroll(dd, ds)));
        var_set_bool(res, TRUE);
        break;
    }
    default:
        default_spell(cmd, res);
        break;
    }
}
Example #9
0
bool Lightning::Zap(Coord dir)
{
    fire_bolt(game->hero().position(), &dir, "bolt");
    discover(false);
    return true;
}
Example #10
0
/*
 * do_cmd_cast calls this function if the player's class
 * is 'imitator'.
 */
static bool use_mane(int spell)
{
    int             dir;
    int             plev = p_ptr->lev;
    u32b mode = (PM_ALLOW_GROUP | PM_FORCE_PET);
    u32b u_mode = 0L;

    if (randint1(50+plev) < plev/10) u_mode = PM_ALLOW_UNIQUE;

    /* spell code */
    switch (spell)
    {
    case MS_SHRIEK:
        msg_print("You make a high pitched shriek.");
        aggravate_monsters(0);
        break;
    case MS_XXX1:
        break;
    case MS_DISPEL:
    {
        int m_idx;

        if (!target_set(TARGET_KILL)) return FALSE;
        m_idx = cave[target_row][target_col].m_idx;
        if (!m_idx) break;
        if (!player_has_los_bold(target_row, target_col)) break;
        if (!projectable(py, px, target_row, target_col)) break;
        dispel_monster_status(m_idx);
        break;
    }
    case MS_ROCKET:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You fire a rocket.");
        fire_rocket(GF_ROCKET, dir, damage, 2);
        break;
    case MS_SHOOT:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You fire an arrow.");
        fire_bolt(GF_ARROW, dir, damage);
        break;
    case MS_XXX2:
        break;
    case MS_XXX3:
        break;
    case MS_BR_STORM:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You breathe storm.");
        fire_ball(GF_STORM, dir, damage, (plev > 35 ? -3 : -2));
        break;
    case MS_BR_ACID:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You breathe acid.");
        fire_ball(GF_ACID, dir, damage, (plev > 35 ? -3 : -2));
        break;
    case MS_BR_ELEC:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You breathe lightning.");
        fire_ball(GF_ELEC, dir, damage, (plev > 35 ? -3 : -2));
        break;
    case MS_BR_FIRE:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You breathe fire.");
        fire_ball(GF_FIRE, dir, damage, (plev > 35 ? -3 : -2));
        break;
    case MS_BR_COLD:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You breathe frost.");
        fire_ball(GF_COLD, dir, damage, (plev > 35 ? -3 : -2));
        break;
    case MS_BR_POIS:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You breathe gas.");
        fire_ball(GF_POIS, dir, damage, (plev > 35 ? -3 : -2));
        break;
    case MS_BR_NETHER:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You breathe nether.");
        fire_ball(GF_NETHER, dir, damage, (plev > 35 ? -3 : -2));
        break;
    case MS_BR_LITE:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You breathe light.");
        fire_ball(GF_LITE, dir, damage, (plev > 35 ? -3 : -2));
        break;
    case MS_BR_DARK:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You breathe darkness.");
        fire_ball(GF_DARK, dir, damage, (plev > 35 ? -3 : -2));
        break;
    case MS_BR_CONF:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You breathe confusion.");
        fire_ball(GF_CONFUSION, dir, damage, (plev > 35 ? -3 : -2));
        break;
    case MS_BR_SOUND:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You breathe sound.");
        fire_ball(GF_SOUND, dir, damage, (plev > 35 ? -3 : -2));
        break;
    case MS_BR_CHAOS:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You breathe chaos.");
        fire_ball(GF_CHAOS, dir, damage, (plev > 35 ? -3 : -2));
        break;
    case MS_BR_DISEN:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You breathe disenchantment.");
        fire_ball(GF_DISENCHANT, dir, damage, (plev > 35 ? -3 : -2));
        break;
    case MS_BR_NEXUS:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You breathe nexus.");
        fire_ball(GF_NEXUS, dir, damage, (plev > 35 ? -3 : -2));
        break;
    case MS_BR_TIME:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You breathe time.");
        fire_ball(GF_TIME, dir, damage, (plev > 35 ? -3 : -2));
        break;
    case MS_BR_INERTIA:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You breathe inertia.");
        fire_ball(GF_INERT, dir, damage, (plev > 35 ? -3 : -2));
        break;
    case MS_BR_GRAVITY:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You breathe gravity.");
        fire_ball(GF_GRAVITY, dir, damage, (plev > 35 ? -3 : -2));
        break;
    case MS_BR_SHARDS:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You breathe shards.");
        fire_ball(GF_SHARDS, dir, damage, (plev > 35 ? -3 : -2));
        break;
    case MS_BR_PLASMA:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You breathe plasma.");
        fire_ball(GF_PLASMA, dir, damage, (plev > 35 ? -3 : -2));
        break;
    case MS_BR_FORCE:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You breathe force.");
        fire_ball(GF_FORCE, dir, damage, (plev > 35 ? -3 : -2));
        break;
    case MS_BR_MANA:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You breathe mana.");
        fire_ball(GF_MANA, dir, damage, (plev > 35 ? -3 : -2));
        break;
    case MS_BALL_NUKE:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You cast a ball of radiation.");
        fire_ball(GF_NUKE, dir, damage, 2);
        break;
    case MS_BR_NUKE:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You breathe toxic waste.");
        fire_ball(GF_NUKE, dir, damage, (plev > 35 ? -3 : -2));
        break;
    case MS_BALL_CHAOS:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You invoke a raw Logrus.");
        fire_ball(GF_CHAOS, dir, damage, 4);
        break;
    case MS_BR_DISI:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You breathe disintegration.");
        fire_ball(GF_DISINTEGRATE, dir, damage, (plev > 35 ? -3 : -2));
        break;
    case MS_BALL_ACID:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You cast an acid ball.");
        fire_ball(GF_ACID, dir, damage, 2);
        break;
    case MS_BALL_ELEC:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You cast a lightning ball.");
        fire_ball(GF_ELEC, dir, damage, 2);
        break;
    case MS_BALL_FIRE:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You cast a fire ball.");
        fire_ball(GF_FIRE, dir, damage, 2);
        break;
    case MS_BALL_COLD:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You cast a frost ball.");
        fire_ball(GF_COLD, dir, damage, 2);
        break;
    case MS_BALL_POIS:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You cast a stinking cloud.");
        fire_ball(GF_POIS, dir, damage, 2);
        break;
    case MS_BALL_NETHER:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You cast a nether ball.");
        fire_ball(GF_NETHER, dir, damage, 2);
        break;
    case MS_BALL_WATER:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You gesture fluidly.");
        fire_ball(GF_WATER, dir, damage, 4);
        break;
    case MS_BALL_MANA:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You invoke a mana storm.");
        fire_ball(GF_MANA, dir, damage, 4);
        break;
    case MS_BALL_DARK:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You invoke a darkness storm.");
        fire_ball(GF_DARK, dir, damage, 4);
        break;
    case MS_DRAIN_MANA:
        if (!get_aim_dir(&dir)) return FALSE;
        fire_ball_hide(GF_DRAIN_MANA, dir, randint1(plev*3)+plev, 0);
        break;
    case MS_MIND_BLAST:
        if (!get_aim_dir(&dir)) return FALSE;
        fire_ball_hide(GF_MIND_BLAST, dir, damage, 0);
        break;
    case MS_BRAIN_SMASH:
        if (!get_aim_dir(&dir)) return FALSE;
        fire_ball_hide(GF_BRAIN_SMASH, dir, damage, 0);
        break;
    case MS_CAUSE_1:
        if (!get_aim_dir(&dir)) return FALSE;
        fire_ball_hide(GF_CAUSE_1, dir, damage, 0);
        break;
    case MS_CAUSE_2:
        if (!get_aim_dir(&dir)) return FALSE;
        fire_ball_hide(GF_CAUSE_2, dir, damage, 0);
        break;
    case MS_CAUSE_3:
        if (!get_aim_dir(&dir)) return FALSE;
        fire_ball_hide(GF_CAUSE_3, dir, damage, 0);
        break;
    case MS_CAUSE_4:
        if (!get_aim_dir(&dir)) return FALSE;
        fire_ball_hide(GF_CAUSE_4, dir, damage, 0);
        break;
    case MS_BOLT_ACID:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You cast an acid bolt.");
        fire_bolt(GF_ACID, dir, damage);
        break;
    case MS_BOLT_ELEC:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You cast a lightning bolt.");
        fire_bolt(GF_ELEC, dir, damage);
        break;
    case MS_BOLT_FIRE:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You cast a fire bolt.");
        fire_bolt(GF_FIRE, dir, damage);
        break;
    case MS_BOLT_COLD:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You cast a frost bolt.");
        fire_bolt(GF_COLD, dir, damage);
        break;
    case MS_STARBURST:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You invoke a starburst.");
        fire_ball(GF_LITE, dir, damage, 4);
        break;
    case MS_BOLT_NETHER:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You cast a nether bolt.");
        fire_bolt(GF_NETHER, dir, damage);
        break;
    case MS_BOLT_WATER:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You cast a water bolt.");
        fire_bolt(GF_WATER, dir, damage);
        break;
    case MS_BOLT_MANA:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You cast a mana bolt.");
        fire_bolt(GF_MANA, dir, damage);
        break;
    case MS_BOLT_PLASMA:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You cast a plasma bolt.");
        fire_bolt(GF_PLASMA, dir, damage);
        break;
    case MS_BOLT_ICE:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You cast a ice bolt.");
        fire_bolt(GF_ICE, dir, damage);
        break;
    case MS_MAGIC_MISSILE:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You cast a magic missile.");
        fire_bolt(GF_MISSILE, dir, damage);
        break;
    case MS_SCARE:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You cast a fearful illusion.");
        fear_monster(dir, plev+10);
        break;
    case MS_BLIND:
        if (!get_aim_dir(&dir)) return FALSE;
        confuse_monster(dir, plev * 2);
        break;
    case MS_CONF:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You cast a mesmerizing illusion.");
        confuse_monster(dir, plev * 2);
        break;
    case MS_SLOW:
        if (!get_aim_dir(&dir)) return FALSE;
        slow_monster(dir);
        break;
    case MS_SLEEP:
        if (!get_aim_dir(&dir)) return FALSE;
        sleep_monster(dir, plev*3);
        break;
    case MS_SPEED:
        (void)set_fast(randint1(20 + plev) + plev, FALSE);
        break;
    case MS_HAND_DOOM:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You invoke the Hand of Doom!");
        fire_ball_hide(GF_HAND_DOOM, dir, 200, 0);
        break;
    case MS_HEAL:
        msg_print("You concentrate on your wounds!");
        (void)hp_player(plev*6);
        (void)set_stun(0, TRUE);
        (void)set_cut(0, TRUE);
        break;
    case MS_INVULNER:
        msg_print("You cast a Globe of Invulnerability.");
        (void)set_invuln(randint1(7) + 7, FALSE);
        break;
    case MS_BLINK:
        if (mut_present(MUT_ASTRAL_GUIDE))
            energy_use = 30;
        teleport_player(10, 0L);
        break;
    case MS_TELEPORT:
        if (mut_present(MUT_ASTRAL_GUIDE))
            energy_use = 30;
        teleport_player(plev * 5, 0L);
        break;
    case MS_WORLD:
        world_player = TRUE;
        if (damage == 1 || damage == 2)
            msg_print("You yell 'The World! Time has stopped!'");
        else if (damage == 3 || damage == 6)
            msg_print("You yell 'Time!'");
        else
            msg_print("hek!");
        msg_print(NULL);

        p_ptr->energy_need -= 1000 + (100 + randint1(200)+200)*TURNS_PER_TICK/10;
        p_ptr->redraw |= (PR_MAP);
        p_ptr->update |= (PU_MONSTERS);
        p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
        handle_stuff();
        break;
    case MS_SPECIAL:
        break;
    case MS_TELE_TO:
    {
        monster_type *m_ptr;
        monster_race *r_ptr;
        char m_name[80];

        if (!target_set(TARGET_KILL)) return FALSE;
        if (!cave[target_row][target_col].m_idx) break;
        if (!player_has_los_bold(target_row, target_col)) break;
        if (!projectable(py, px, target_row, target_col)) break;
        m_ptr = &m_list[cave[target_row][target_col].m_idx];
        r_ptr = &r_info[m_ptr->r_idx];
        monster_desc(m_name, m_ptr, 0);
        if (r_ptr->flagsr & RFR_RES_TELE)
        {
            if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
            {
                if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
                msg_format("%s is unaffected!", m_name);
                break;
            }
            else if (r_ptr->level > randint1(100))
            {
                if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
                msg_format("%s resists!", m_name);
                break;
            }
        }
        msg_format("You command %s to return.", m_name);
        teleport_monster_to(cave[target_row][target_col].m_idx, py, px, 100, TELEPORT_PASSIVE);
        break;
    }
    case MS_TELE_AWAY:
        if (!get_aim_dir(&dir)) return FALSE;
        (void)fire_beam(GF_AWAY_ALL, dir, plev);
        break;
    case MS_TELE_LEVEL:
    {
        int target_m_idx;
        monster_type *m_ptr;
        monster_race *r_ptr;
        char m_name[80];

        if (!target_set(TARGET_KILL)) return FALSE;
        target_m_idx = cave[target_row][target_col].m_idx;
        if (!target_m_idx) break;
        if (!player_has_los_bold(target_row, target_col)) break;
        if (!projectable(py, px, target_row, target_col)) break;
        m_ptr = &m_list[target_m_idx];
        r_ptr = &r_info[m_ptr->r_idx];
        monster_desc(m_name, m_ptr, 0);
        msg_format("You gesture at %^s's feet.", m_name);
        if ((r_ptr->flagsr & (RFR_EFF_RES_NEXU_MASK | RFR_RES_TELE)) ||
            (r_ptr->flags1 & RF1_QUESTOR) || (r_ptr->level + randint1(50) > plev + randint1(60)))
        {
            msg_format("%^s is unaffected!", m_name);
        }
        else teleport_level(target_m_idx);
        break;
    }
    case MS_PSY_SPEAR:
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You throw a psycho-spear.");
        fire_beam(GF_PSY_SPEAR, dir, damage);
        break;
    case MS_DARKNESS:
        msg_print("You gesture in shadow.");
        unlite_area(10, 3);
        break;
    case MS_MAKE_TRAP:
        if (!target_set(TARGET_KILL)) return FALSE;
        msg_print("You cast a spell and cackle evilly.");
        trap_creation(target_row, target_col);
        break;
    case MS_FORGET:
        msg_print("Nothing happens.");
        /* TODO: forget_spell(m_idx) ... */
        break;
    case MS_RAISE_DEAD:
        msg_print("You cast a animate dead.");
        animate_dead(0, py, px);
        break;
    case MS_S_KIN:
    {
        int k;
        if (!target_set(TARGET_KILL)) return FALSE;
        msg_print("You summon minions.");
        for (k = 0;k < 4; k++)
        {
            (void)summon_kin_player(plev, target_row, target_col, (PM_FORCE_PET | PM_ALLOW_GROUP));
        }
        break;
    }
    case MS_S_CYBER:
    {
        int k;
        int max_cyber = (dun_level / 50) + randint1(3);
        if (!target_set(TARGET_KILL)) return FALSE;
            msg_print("You summon Cyberdemons!");
        if (max_cyber > 4) max_cyber = 4;
        for (k = 0;k < max_cyber; k++)
            summon_specific(-1, target_row, target_col, plev, SUMMON_CYBER, mode);
        break;
    }
    case MS_S_MONSTER:
    {
        int k;
        if (!target_set(TARGET_KILL)) return FALSE;
        msg_print("You summon help.");
        for (k = 0;k < 1; k++)
            summon_specific(-1, target_row, target_col, plev, 0, (mode | u_mode));
        break;
    }
    case MS_S_MONSTERS:
    {
        int k;
        if (!target_set(TARGET_KILL)) return FALSE;
            msg_print("You summon monsters!");
        for (k = 0;k < 6; k++)
            summon_specific(-1, target_row, target_col, plev, 0, (mode | u_mode));
        break;
    }
    case MS_S_ANT:
    {
        int k;
        if (!target_set(TARGET_KILL)) return FALSE;
        msg_print("You summon ants.");
        for (k = 0;k < 6; k++)
            summon_specific(-1, target_row, target_col, plev, SUMMON_ANT, mode);
        break;
    }
    case MS_S_SPIDER:
    {
        int k;
        if (!target_set(TARGET_KILL)) return FALSE;
        msg_print("You summon spiders.");
        for (k = 0;k < 6; k++)
            summon_specific(-1, target_row, target_col, plev, SUMMON_SPIDER, mode);
        break;
    }
    case MS_S_HOUND:
    {
        int k;
        if (!target_set(TARGET_KILL)) return FALSE;
        msg_print("You summon hounds.");
        for (k = 0;k < 4; k++)
            summon_specific(-1, target_row, target_col, plev, SUMMON_HOUND, mode);
        break;
    }
    case MS_S_HYDRA:
    {
        int k;
        if (!target_set(TARGET_KILL)) return FALSE;
        msg_print("You summon hydras.");
        for (k = 0;k < 4; k++)
            summon_specific(-1, target_row, target_col, plev, SUMMON_HYDRA, mode);
        break;
    }
    case MS_S_ANGEL:
    {
        int k;
        if (!target_set(TARGET_KILL)) return FALSE;
        msg_print("You summon angel!");
        for (k = 0;k < 1; k++)
            summon_specific(-1, target_row, target_col, plev, SUMMON_ANGEL, mode);
        break;
    }
    case MS_S_DEMON:
    {
        int k;
        if (!target_set(TARGET_KILL)) return FALSE;
        msg_print("You summon a demon from the Courts of Chaos!");
        for (k = 0;k < 1; k++)
            summon_specific(-1, target_row, target_col, plev, SUMMON_DEMON, (mode | u_mode));
        break;
    }
    case MS_S_UNDEAD:
    {
        int k;
        if (!target_set(TARGET_KILL)) return FALSE;
        msg_print("You summon an undead adversary!");
        for (k = 0;k < 1; k++)
            summon_specific(-1, target_row, target_col, plev, SUMMON_UNDEAD, (mode | u_mode));
        break;
    }
    case MS_S_DRAGON:
    {
        int k;
        if (!target_set(TARGET_KILL)) return FALSE;
        msg_print("You summon dragon!");
        for (k = 0;k < 1; k++)
            summon_specific(-1, target_row, target_col, plev, SUMMON_DRAGON, (mode | u_mode));
        break;
    }
    case MS_S_HI_UNDEAD:
    {
        int k;
        if (!target_set(TARGET_KILL)) return FALSE;
        msg_print("You summon greater undead!");
        for (k = 0;k < 6; k++)
            summon_specific(-1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
        break;
    }
    case MS_S_HI_DRAGON:
    {
        int k;
        if (!target_set(TARGET_KILL)) return FALSE;
        msg_print("You summon ancient dragons!");
        for (k = 0;k < 4; k++)
            summon_specific(-1, target_row, target_col, plev, SUMMON_HI_DRAGON, (mode | u_mode));
        break;
    }
    case MS_S_AMBERITE:
    {
        int k;
        if (!target_set(TARGET_KILL)) return FALSE;
        msg_print("You summon Lords of Amber!");
        for (k = 0;k < 4; k++)
            summon_specific(-1, target_row, target_col, plev, SUMMON_AMBERITE, (mode | PM_ALLOW_UNIQUE));
        break;
    }
    case MS_S_UNIQUE:
    {
        int k, count = 0;
        if (!target_set(TARGET_KILL)) return FALSE;
        msg_print("You summon special opponents!");
        for (k = 0;k < 4; k++)
            if (summon_specific(-1, target_row, target_col, plev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE))) count++;
        for (k = count;k < 4; k++)
            summon_specific(-1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
        break;
    }
    default:
        msg_print("hoge?");
    }

    return TRUE;
}
Example #11
0
/**
 * Cast a spell.
 * @param op The creature that is owner of the object that is casting the
 * spell.
 * @param caster The actual object (wand, potion) casting the spell. Can
 * be same as op.
 * @param dir Direction to cast in.
 * @param type Spell ID.
 * @param ability If true, the spell is the innate ability of a monster
 * (ie, don't check for blocks_magic(), and don't add AT_MAGIC to attacktype).
 * @param item The type of object that is casting the spell.
 * @param stringarg Any options that are being used.
 * @return 0 on failure, non-zero on success and is used by caller to
 * drain mana/grace. */
int cast_spell(object *op, object *caster, int dir, int type, int ability, SpellTypeFrom item, char *stringarg)
{
	spell *s = find_spell(type);
	shstr *godname = NULL;
	object *target = NULL;
	int success = 0, duration, spell_cost = 0;

	if (!s)
	{
		LOG(llevBug, "BUG: cast_spell(): Unknown spell: %d\n", type);
		return 0;
	}

	/* Get the base duration */
	duration = spells[type].bdur;

	if (!op)
	{
		op = caster;
	}

	/* Script NPCs can ALWAYS cast - even in no spell areas! */
	if (item == spellNPC)
	{
		/* If spellNPC, this usually comes from a script,
		 * and caster is the NPC and op the target. */
		target = op;
		op = caster;
	}
	else
	{
		/* It looks like the only properties we ever care about from the casting
		 * object (caster) is spell paths and level. */
		object *cast_op = op;

		if (!caster)
		{
			if (item == spellNormal)
			{
				caster = op;
			}
		}
		else
		{
			/* Caster has a map? Then we use caster */
			if (caster->map)
			{
				cast_op = caster;
			}
		}

		/* No magic and not a prayer. */
		if (MAP_NOMAGIC(cast_op->map) && spells[type].type == SPELL_TYPE_WIZARD)
		{
			new_draw_info(NDI_UNIQUE, op, "Powerful countermagic cancels all spellcasting here!");
			return 0;
		}

		/* No prayer and a prayer. */
		if (MAP_NOPRIEST(cast_op->map) && spells[type].type == SPELL_TYPE_PRIEST)
		{
			new_draw_info(NDI_UNIQUE, op, "Powerful countermagic cancels all prayer spells here!");
			return 0;
		}

		/* No harm spell and not town safe. */
		if (MAP_NOHARM(cast_op->map) && !(spells[type].flags & SPELL_DESC_TOWN))
		{
			new_draw_info(NDI_UNIQUE, op, "Powerful countermagic cancels all harmful magic here!");
			return 0;
		}

		if (op->type == PLAYER)
		{
			CONTR(op)->praying = 0;

			/* Cancel player spells which are denied, but only real spells (not
			 * potions, wands, etc). */
			if (item == spellNormal)
			{
				if (caster->path_denied & s->path)
				{
					new_draw_info(NDI_UNIQUE, op, "It is denied for you to cast that spell.");
					return 0;
				}

				if (!(QUERY_FLAG(op, FLAG_WIZ)))
				{
					if (spells[type].type == SPELL_TYPE_WIZARD && op->stats.sp < SP_level_spellpoint_cost(caster, type, -1))
					{
						new_draw_info(NDI_UNIQUE, op, "You don't have enough mana.");
						return 0;
					}

					if (spells[type].type == SPELL_TYPE_PRIEST && op->stats.grace < SP_level_spellpoint_cost(caster, type, -1))
					{
						new_draw_info(NDI_UNIQUE, op, "You don't have enough grace.");
						return 0;
					}
				}
			}

			/* If it a prayer, grab the player's god - if we have none, we
			 * can't cast, except for potions. */
			if (spells[type].type == SPELL_TYPE_PRIEST && item != spellPotion)
			{
				if ((godname = determine_god(op)) == shstr_cons.none)
				{
					new_draw_info(NDI_UNIQUE, op, "You need a deity to cast a prayer!");
					return 0;
				}
			}
		}

		/* If it is an ability, assume that the designer of the archetype
		 * knows what they are doing. */
		if (item == spellNormal && !ability && SK_level(caster) < s->level && !QUERY_FLAG(op, FLAG_WIZ))
		{
			new_draw_info(NDI_UNIQUE, op, "You lack enough skill to cast that spell.");
			return 0;
		}

		if (item == spellPotion)
		{
			/* If the potion casts a self spell, don't use the facing
			 * direction. */
			if (spells[type].flags & SPELL_DESC_SELF)
			{
				target = op;
				dir = 0;
			}
		}
		else if (find_target_for_spell(op, &target, spells[type].flags) == 0)
		{
			new_draw_info_format(NDI_UNIQUE, op, "You can't cast that spell on %s!", target ? target->name : "yourself");
			return 0;
		}

		/* If valid target is not in range for selected spell, skip casting. */
		if (target)
		{
			rv_vector rv;

			if (!get_rangevector_from_mapcoords(op->map, op->x, op->y, target->map, target->x, target->y, &rv, RV_DIAGONAL_DISTANCE) || rv.distance > (unsigned int) spells[type].range)
			{
				new_draw_info(NDI_UNIQUE, op, "Your target is out of range!");
				return 0;
			}
		}

		if (op->type == PLAYER && target == op && CONTR(op)->target_object != op)
		{
			new_draw_info(NDI_UNIQUE, op, "You auto-target yourself with this spell!");
		}

		if (!ability && ((s->type == SPELL_TYPE_WIZARD && blocks_magic(op->map, op->x, op->y)) || (s->type == SPELL_TYPE_PRIEST && blocks_cleric(op->map, op->x, op->y))))
		{
			if (op->type != PLAYER)
			{
				return 0;
			}

			if (s->type == SPELL_TYPE_PRIEST)
			{
				new_draw_info_format(NDI_UNIQUE, op, "This ground is unholy! %s ignores you.", godname);
			}
			else
			{
				switch (CONTR(op)->shoottype)
				{
					case range_magic:
						new_draw_info(NDI_UNIQUE, op, "Something blocks your spellcasting.");
						break;

					case range_wand:
						new_draw_info(NDI_UNIQUE, op, "Something blocks the magic of your wand.");
						break;

					case range_rod:
						new_draw_info(NDI_UNIQUE, op, "Something blocks the magic of your rod.");
						break;

					case range_horn:
						new_draw_info(NDI_UNIQUE, op, "Something blocks the magic of your horn.");
						break;

					case range_scroll:
						new_draw_info(NDI_UNIQUE, op, "Something blocks the magic of your scroll.");
						break;

					default:
						break;
				}
			}

			return 0;
		}

		if (item == spellNormal && op->type == PLAYER)
		{
			/* Chance to fumble the spell by too low wisdom. */
			if (s->type == SPELL_TYPE_PRIEST && rndm(0, 99) < s->level / (float) MAX(1, op->chosen_skill->level) * cleric_chance[op->stats.Wis])
			{
				play_sound_player_only(CONTR(op), SOUND_FUMBLE_SPELL, SOUND_NORMAL, 0, 0);
				new_draw_info(NDI_UNIQUE, op, "You fumble the prayer because your wisdom is low.");

				/* Shouldn't happen... */
				if (s->sp == 0)
				{
					return 0;
				}

				return rndm(1, SP_level_spellpoint_cost(caster, type, -1));
			}

			if (s->type == SPELL_TYPE_WIZARD)
			{
				int failure = rndm(0, 199) - CONTR(op)->encumbrance + op->chosen_skill->level - s->level + 35;

				if (failure < 0)
				{
					new_draw_info(NDI_UNIQUE, op, "You bungle the spell because you have too much heavy equipment in use.");
					return rndm(0, SP_level_spellpoint_cost(caster, type, -1));
				}
			}
		}

		/* Now let's talk about action/shooting speed */
		if (op->type == PLAYER)
		{
			switch (CONTR(op)->shoottype)
			{
				case range_wand:
				case range_rod:
				case range_horn:
					op->chosen_skill->stats.maxsp = caster->last_grace;
					break;

				default:
					break;
			}
		}
	}

	/* A last sanity check: are caster and target *really* valid? */
	if ((caster && !OBJECT_ACTIVE(caster)) || (target && !OBJECT_ACTIVE(target)))
	{
		return 0;
	}

	/* We need to calculate the spell point cost before the spell actually
	 * does something, otherwise the following can happen (example):
	 * Player has 7 mana left, kills a monster with magic bullet (which costs 7
	 * mana) while standing right next to it, magic bullet kills the monster before
	 * we reach the return here, player levels up, cost of magic bullet increases
	 * from 7 to 8. So the function would return 8 instead of 7, resulting in the
	 * player's mana being -1. */
	if (item != spellNPC)
	{
		spell_cost = SP_level_spellpoint_cost(caster, type, -1);
	}

	switch ((enum spellnrs) type)
	{
		case SP_RESTORATION:
		case SP_CURE_CONFUSION:
		case SP_MINOR_HEAL:
		case SP_GREATER_HEAL:
		case SP_CURE_POISON:
		case SP_CURE_DISEASE:
			success = cast_heal(op, SK_level(caster), target, type);
			break;

		case SP_REMOVE_DEPLETION:
			success = remove_depletion(op, target);
			break;

		case SP_REMOVE_CURSE:
		case SP_REMOVE_DAMNATION:
			success = remove_curse(op, target, type, item);
			break;

		case SP_STRENGTH:
		case SP_PROT_COLD:
		case SP_PROT_FIRE:
		case SP_PROT_ELEC:
		case SP_PROT_POISON:
			success = cast_change_attr(op, caster, target, type);
			break;

		case SP_IDENTIFY:
			success = cast_identify(target, SK_level(caster), NULL, IDENTIFY_MODE_NORMAL);
			break;

		/* Spells after this use direction and not a target */
		case SP_ICESTORM:
		case SP_FIRESTORM:
			success = cast_cone(op, caster, dir, duration, type, spellarch[type]);
			break;

		case SP_PROBE:
			if (!dir)
			{
				examine(op, op);
				success = 1;
			}
			else
			{
				success = fire_arch_from_position(op, caster, op->x, op->y, dir, spellarch[type], type, NULL);
			}

			break;

		case SP_BULLET:
		case SP_CAUSE_LIGHT:
		case SP_MAGIC_MISSILE:
			success = fire_arch_from_position(op, caster, op->x, op->y, dir, spellarch[type], type, target);
			break;

		case SP_TOWN_PORTAL:
			success = cast_create_town_portal(op);
			break;

		case SP_WOR:
			success = cast_wor(op, caster);
			break;

		case SP_CREATE_FOOD:
			success = cast_create_food(op, caster, dir, stringarg);
			break;

		case SP_CHARGING:
			success = recharge(op);
			break;

		case SP_CONSECRATE:
			success = cast_consecrate(op);
			break;

		case SP_CAUSE_COLD:
		case SP_CAUSE_FLU:
		case SP_CAUSE_LEPROSY:
		case SP_CAUSE_SMALLPOX:
		case SP_CAUSE_PNEUMONIC_PLAGUE:
			success = cast_cause_disease(op, caster, dir, spellarch[type], type);
			break;

		case SP_FINGER_DEATH:
			success = finger_of_death(op, target);
			break;

		case SP_POISON_FOG:
		case SP_METEOR:
		case SP_ASTEROID:
			success = fire_arch_from_position(op, caster, op->x, op->y, dir, spellarch[type], type, NULL);
			break;

		case SP_METEOR_SWARM:
			success = 1;
			fire_swarm(op, caster, dir, spellarch[type], SP_METEOR, 3, 0);
			break;

		case SP_FROST_NOVA:
			success = 1;
			fire_swarm(op, caster, dir, spellarch[type], SP_ASTEROID, 3, 0);
			break;

		case SP_BULLET_SWARM:
			success = 1;
			fire_swarm(op, caster, dir, spellarch[type], SP_BULLET, 5, 0);
			break;

		case SP_BULLET_STORM:
			success = 1;
			fire_swarm(op, caster, dir, spellarch[type], SP_BULLET, 3, 0);
			break;

		case SP_DESTRUCTION:
			success = cast_destruction(op, caster, 5 + op->stats.Int, AT_MAGIC);
			break;

		case SP_BOMB:
			success = create_bomb(op, caster, dir, type);
			break;

		case SP_TRANSFORM_WEALTH:
			success = cast_transform_wealth(op);
			break;

		case SP_RAIN_HEAL:
		case SP_PARTY_HEAL:
			success = cast_heal_around(op, SK_level(caster), type);
			break;

		case SP_FROSTBOLT:
		case SP_FIREBOLT:
		case SP_LIGHTNING:
		case SP_FORKED_LIGHTNING:
		case SP_NEGABOLT:
			success = fire_bolt(op, caster, dir, type);
			break;

		default:
			LOG(llevBug, "BUG: cast_spell(): Invalid invalid spell: %d\n", type);
			break;
	}

	play_sound_map(op->map, op->x, op->y, spells[type].sound, SOUND_SPELL);

	if (item == spellNPC)
	{
		return success;
	}

	return success ? spell_cost : 0;
}
Example #12
0
/*
 * do_cmd_cast calls this function if the player's class
 * is 'imitator'.
 */
static bool cast_learned_spell(int spell, bool success)
{
    int             dir;
    int             plev = pseudo_plev();
    int     summon_lev = p_ptr->lev * 2 / 3 + randint1(p_ptr->lev/2);
    int             hp = p_ptr->chp;
    int             damage = 0;
    bool   pet = success;
    bool   no_trump = FALSE;
    u32b p_mode, u_mode = 0L, g_mode;

    if (pet)
    {
        p_mode = PM_FORCE_PET;
        g_mode = 0;
    }
    else
    {
        p_mode = PM_NO_PET;
        g_mode = PM_ALLOW_GROUP;
    }

    if (!success || (randint1(50+plev) < plev/10)) u_mode = PM_ALLOW_UNIQUE;

    /* spell code */
    switch (spell)
    {
    case MS_SHRIEK:
        msg_print("You make a high pitched shriek.");

        aggravate_monsters(0);
        break;
    case MS_XXX1:
        break;
    case MS_DISPEL:
    {
        int m_idx;

        if (!target_set(TARGET_KILL)) return FALSE;
        m_idx = cave[target_row][target_col].m_idx;
        if (!m_idx) break;
        if (!player_has_los_bold(target_row, target_col)) break;
        if (!projectable(py, px, target_row, target_col)) break;
        dispel_monster_status(m_idx);
        break;
    }
    case MS_ROCKET:
        if (!get_aim_dir(&dir)) return FALSE;
        else
            msg_print("You fire a rocket.");
        damage = hp / 4;
        fire_rocket(GF_ROCKET, dir, spell_power(damage), 2);
        break;
    case MS_SHOOT:
    {
        int slot;
        if (!get_aim_dir(&dir)) return FALSE;

        msg_print("You fire an arrow.");
        damage = 1;
        slot = equip_find_first(object_is_melee_weapon);
        if (slot)
        {
            object_type *o_ptr = equip_obj(slot);
            damage = damroll(o_ptr->dd, o_ptr->ds)+ o_ptr->to_d;
            if (damage < 1) damage = 1;
        }
        fire_bolt(GF_ARROW, dir, spell_power(damage));
        break;
    }
    case MS_XXX2:
        break;
    case MS_XXX3:
        break;
    case MS_BR_STORM:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You breathe storm.");
        damage = MIN(hp / 3, 300);
        fire_ball(GF_STORM, dir, spell_power(damage), (plev > 40 ? -3 : -2));
        break;
    case MS_BR_ACID:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You breathe acid.");
        damage = hp / 3;
        fire_ball(GF_ACID, dir, spell_power(damage), (plev > 40 ? -3 : -2));
        break;
    case MS_BR_ELEC:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You breathe lightning.");
        damage = hp / 3;
        fire_ball(GF_ELEC, dir, spell_power(damage), (plev > 40 ? -3 : -2));
        break;
    case MS_BR_FIRE:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You breathe fire.");
        damage = hp / 3;
        fire_ball(GF_FIRE, dir, spell_power(damage), (plev > 40 ? -3 : -2));
        break;
    case MS_BR_COLD:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You breathe frost.");
        damage = hp / 3;
        fire_ball(GF_COLD, dir, spell_power(damage), (plev > 40 ? -3 : -2));
        break;
    case MS_BR_POIS:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You breathe gas.");
        damage = hp / 3;
        fire_ball(GF_POIS, dir, spell_power(damage), (plev > 40 ? -3 : -2));
        break;
    case MS_BR_NETHER:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You breathe nether.");
        damage = hp / 6;
        fire_ball(GF_NETHER, dir, spell_power(damage), (plev > 40 ? -3 : -2));
        break;
    case MS_BR_LITE:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You breathe light.");
        damage = hp / 6;
        fire_ball(GF_LITE, dir, spell_power(damage), (plev > 40 ? -3 : -2));
        break;
    case MS_BR_DARK:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You breathe darkness.");
        damage = hp / 6;
        fire_ball(GF_DARK, dir, spell_power(damage), (plev > 40 ? -3 : -2));
        break;
    case MS_BR_CONF:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You breathe confusion.");
        damage = hp / 6;
        fire_ball(GF_CONFUSION, dir, spell_power(damage), (plev > 40 ? -3 : -2));
        break;
    case MS_BR_SOUND:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You breathe sound.");
        damage = hp / 6;
        fire_ball(GF_SOUND, dir, spell_power(damage), (plev > 40 ? -3 : -2));
        break;
    case MS_BR_CHAOS:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You breathe chaos.");
        damage = hp / 6;
        fire_ball(GF_CHAOS, dir, spell_power(damage), (plev > 40 ? -3 : -2));
        break;
    case MS_BR_DISEN:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You breathe disenchantment.");
        damage = hp / 6;
        fire_ball(GF_DISENCHANT, dir, spell_power(damage), (plev > 40 ? -3 : -2));
        break;
    case MS_BR_NEXUS:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You breathe nexus.");
        damage = MIN(hp / 3, 250);
        fire_ball(GF_NEXUS, dir, spell_power(damage), (plev > 40 ? -3 : -2));
        break;
    case MS_BR_TIME:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You breathe time.");
        damage = MIN(hp / 3, 150);
        fire_ball(GF_TIME, dir, spell_power(damage), (plev > 40 ? -3 : -2));
        break;
    case MS_BR_INERTIA:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You breathe inertia.");
        damage = MIN(hp / 6, 200);
        fire_ball(GF_INERT, dir, spell_power(damage), (plev > 40 ? -3 : -2));
        break;
    case MS_BR_GRAVITY:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You breathe gravity.");
        damage = MIN(hp / 3, 200);
        fire_ball(GF_GRAVITY, dir, spell_power(damage), (plev > 40 ? -3 : -2));
        break;
    case MS_BR_SHARDS:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You breathe shards.");
        damage = hp / 6;
        fire_ball(GF_SHARDS, dir, spell_power(damage), (plev > 40 ? -3 : -2));
        break;
    case MS_BR_PLASMA:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You breathe plasma.");
        damage = MIN(hp / 6, 150);
        fire_ball(GF_PLASMA, dir, spell_power(damage), (plev > 40 ? -3 : -2));
        break;
    case MS_BR_FORCE:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You breathe force.");
        damage = MIN(hp / 6, 200);
        fire_ball(GF_FORCE, dir, spell_power(damage), (plev > 40 ? -3 : -2));
        break;
    case MS_BR_MANA:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You breathe mana.");
        
        damage = MIN(hp / 3, 250);
        fire_ball(GF_MANA, dir, spell_power(damage), (plev > 40 ? -3 : -2));
        break;
    case MS_BALL_NUKE:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You cast a ball of radiation.");
        damage = plev * 2 + damroll(10, 6);
        fire_ball(GF_NUKE, dir, spell_power(damage), 2);
        break;
    case MS_BR_NUKE:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You breathe toxic waste.");
        damage = hp / 3;
        fire_ball(GF_NUKE, dir, spell_power(damage), (plev > 40 ? -3 : -2));
        break;
    case MS_BALL_CHAOS:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You invoke a raw Logrus.");
        damage = plev * 4 + damroll(10, 10);
        fire_ball(GF_CHAOS, dir, spell_power(damage), 4);
        break;
    case MS_BR_DISI:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You breathe disintegration.");
        damage = MIN(hp / 6, 150);
        fire_ball(GF_DISINTEGRATE, dir, spell_power(damage), (plev > 40 ? -3 : -2));
        break;
    case MS_BALL_ACID:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You cast an acid ball.");
        damage = randint1(plev * 6) + 15;
        fire_ball(GF_ACID, dir, spell_power(damage), 2);
        break;
    case MS_BALL_ELEC:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You cast a lightning ball.");
        damage = randint1(plev * 3) + 8;
        fire_ball(GF_ELEC, dir, spell_power(damage), 2);
        break;
    case MS_BALL_FIRE:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You cast a fire ball.");
        damage = randint1(plev * 7) + 10;
        fire_ball(GF_FIRE, dir, spell_power(damage), 2);
        break;
    case MS_BALL_COLD:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You cast a frost ball.");
        damage = randint1(plev * 3) + 10;
        fire_ball(GF_COLD, dir, spell_power(damage), 2);
        break;
    case MS_BALL_POIS:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You cast a stinking cloud.");
        damage = damroll(12,2);
        fire_ball(GF_POIS, dir, spell_power(damage), 2);
        break;
    case MS_BALL_NETHER:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You cast a nether ball.");
        damage = plev * 2 + 50 + damroll(10, 10);
        fire_ball(GF_NETHER, dir, spell_power(damage), 2);
        break;
    case MS_BALL_WATER:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You gesture fluidly.");
        damage = randint1(plev * 4) + 50;
        fire_ball(GF_WATER, dir, spell_power(damage), 4);
        break;
    case MS_BALL_MANA:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You invoke a mana storm.");
        damage = plev * 8 + 50 + damroll(10, 10);
        fire_ball(GF_MANA, dir, spell_power(damage), 4);
        break;
    case MS_BALL_DARK:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You invoke a darkness storm.");
        damage = plev * 8 + 50 + damroll(10, 10);
        fire_ball(GF_DARK, dir, spell_power(damage), 4);
        break;
    case MS_DRAIN_MANA:
        if (!get_aim_dir(&dir)) return FALSE;
        fire_ball_hide(GF_DRAIN_MANA, dir, spell_power(randint1(plev)+plev), 0);
        break;
    case MS_MIND_BLAST:
        if (!get_aim_dir(&dir)) return FALSE;
        damage = damroll(7, 7);
        fire_ball_hide(GF_MIND_BLAST, dir, spell_power(damage), 0);
        break;
    case MS_BRAIN_SMASH:
        if (!get_aim_dir(&dir)) return FALSE;
        damage = damroll(12, 12);
        fire_ball_hide(GF_BRAIN_SMASH, dir, spell_power(damage), 0);
        break;
    case MS_CAUSE_1:
        if (!get_aim_dir(&dir)) return FALSE;
        damage = damroll(3, 8);
        fire_ball_hide(GF_CAUSE_1, dir, spell_power(damage), 0);
        break;
    case MS_CAUSE_2:
        if (!get_aim_dir(&dir)) return FALSE;
        damage = damroll(8, 8);
        fire_ball_hide(GF_CAUSE_2, dir, spell_power(damage), 0);
        break;
    case MS_CAUSE_3:
        if (!get_aim_dir(&dir)) return FALSE;
        damage = damroll(10, 15);
        fire_ball_hide(GF_CAUSE_3, dir, spell_power(damage), 0);
        break;
    case MS_CAUSE_4:
        if (!get_aim_dir(&dir)) return FALSE;
        damage = damroll(15, 15);
        fire_ball_hide(GF_CAUSE_4, dir, spell_power(damage), 0);
        break;
    case MS_BOLT_ACID:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You cast an acid bolt.");
        damage = damroll(7, 8) + plev * 2 / 3;
        fire_bolt(GF_ACID, dir, spell_power(damage));
        break;
    case MS_BOLT_ELEC:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You cast a lightning bolt.");
        damage = damroll(4, 8) + plev * 2 / 3;
        fire_bolt(GF_ELEC, dir, spell_power(damage));
        break;
    case MS_BOLT_FIRE:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You cast a fire bolt.");
        damage = damroll(9, 8) + plev * 2 / 3;
        fire_bolt(GF_FIRE, dir, spell_power(damage));
        break;
    case MS_BOLT_COLD:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You cast a frost bolt.");
        damage = damroll(6, 8) + plev * 2 / 3;
        fire_bolt(GF_COLD, dir, spell_power(damage));
        break;
    case MS_STARBURST:
        if (!get_aim_dir(&dir)) return FALSE;
        else
            msg_print("You invoke a starburst.");
        damage = plev * 8 + 50 + damroll(10, 10);
        fire_ball(GF_LITE, dir, spell_power(damage), 4);
        break;
    case MS_BOLT_NETHER:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You cast a nether bolt.");
        damage = 30 + damroll(5, 5) + plev * 8 / 3;
        fire_bolt(GF_NETHER, dir, spell_power(damage));
        break;
    case MS_BOLT_WATER:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You cast a water bolt.");
        damage = damroll(10, 10) + plev * 2;
        fire_bolt(GF_WATER, dir, spell_power(damage));
        break;
    case MS_BOLT_MANA:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You cast a mana bolt.");
        damage = randint1(plev * 7) + 50;
        fire_bolt(GF_MANA, dir, spell_power(damage));
        break;
    case MS_BOLT_PLASMA:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You cast a plasma bolt.");
        damage = 10 + damroll(8, 7) + plev * 2;
        fire_bolt(GF_PLASMA, dir, spell_power(damage));
        break;
    case MS_BOLT_ICE:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You cast a ice bolt.");
        damage = damroll(6, 6) + plev * 2;
        fire_bolt(GF_ICE, dir, spell_power(damage));
        break;
    case MS_MAGIC_MISSILE:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You cast a magic missile.");
        damage = damroll(2, 6) + plev * 2 / 3;
        fire_bolt(GF_MISSILE, dir, spell_power(damage));
        break;
    case MS_SCARE:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You cast a fearful illusion.");
        fear_monster(dir, spell_power(plev+10));
        break;
    case MS_BLIND:
        if (!get_aim_dir(&dir)) return FALSE;
        confuse_monster(dir, spell_power(plev * 2));
        break;
    case MS_CONF:
        if (!get_aim_dir(&dir)) return FALSE;
            else msg_print("You cast a mesmerizing illusion.");
        confuse_monster(dir, spell_power(plev * 2));
        break;
    case MS_SLOW:
        if (!get_aim_dir(&dir)) return FALSE;
        slow_monster(dir);
        break;
    case MS_SLEEP:
        if (!get_aim_dir(&dir)) return FALSE;
        sleep_monster(dir, plev*3);
        break;
    case MS_SPEED:
        (void)set_fast(randint1(20 + plev) + plev, FALSE);
        break;
    case MS_HAND_DOOM:
    {
        if (!get_aim_dir(&dir)) return FALSE;
        else msg_print("You invoke the Hand of Doom!");

        fire_ball_hide(GF_HAND_DOOM, dir, spell_power(plev * 3), 0);
        break;
    }
    case MS_HEAL:
            msg_print("You concentrate on your wounds!");
        (void)hp_player(spell_power(plev*4));
        (void)set_stun(0, TRUE);
        (void)set_cut(0, TRUE);
        break;
    case MS_INVULNER:
            msg_print("You cast a Globe of Invulnerability.");
        (void)set_invuln(spell_power(randint1(4) + 4), FALSE);
        break;
    case MS_BLINK:
        teleport_player(10, 0L);
        break;
    case MS_TELEPORT:
        teleport_player(plev * 5, 0L);
        break;
    case MS_WORLD:
        world_player = TRUE;
        msg_print("'Time!'");
        msg_print(NULL);

        /* Hack */
        p_ptr->energy_need -= 1000 + (100 + randint1(200)+200)*TURNS_PER_TICK/10;

        /* Redraw map */
        p_ptr->redraw |= (PR_MAP | PR_STATUS);

        /* Update monsters */
        p_ptr->update |= (PU_MONSTERS);

        /* Window stuff */
        p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);

        handle_stuff();
        break;
    case MS_SPECIAL:
        break;
    case MS_TELE_TO:
    {
        monster_type *m_ptr;
        monster_race *r_ptr;
        char m_name[80];

        if (!target_set(TARGET_KILL)) return FALSE;
        if (!cave[target_row][target_col].m_idx) break;
        if (!player_has_los_bold(target_row, target_col)) break;
        if (!projectable(py, px, target_row, target_col)) break;
        m_ptr = &m_list[cave[target_row][target_col].m_idx];
        r_ptr = &r_info[m_ptr->r_idx];
        monster_desc(m_name, m_ptr, 0);
        if (r_ptr->flagsr & RFR_RES_TELE)
        {
            if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
            {
                if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
                msg_format("%s is unaffected!", m_name);

                break;
            }
            else if (r_ptr->level > randint1(100))
            {
                if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
                msg_format("%s resists!", m_name);

                break;
            }
        }
        msg_format("You command %s to return.", m_name);

        teleport_monster_to(cave[target_row][target_col].m_idx, py, px, 100, TELEPORT_PASSIVE);
        break;
    }
    case MS_TELE_AWAY:
        if (!get_aim_dir(&dir)) return FALSE;

        (void)fire_beam(GF_AWAY_ALL, dir, spell_power(100));
        break;
    case MS_TELE_LEVEL:
    {
        int target_m_idx;
        monster_type *m_ptr;
        monster_race *r_ptr;
        char m_name[80];

        if (!target_set(TARGET_KILL)) return FALSE;
        target_m_idx = cave[target_row][target_col].m_idx;
        if (!target_m_idx) break;
        if (!player_has_los_bold(target_row, target_col)) break;
        if (!projectable(py, px, target_row, target_col)) break;
        m_ptr = &m_list[target_m_idx];
        r_ptr = &r_info[m_ptr->r_idx];
        monster_desc(m_name, m_ptr, 0);
        msg_format("You gesture at %^s's feet.", m_name);

        if ((r_ptr->flagsr & (RFR_EFF_RES_NEXU_MASK | RFR_RES_TELE)) ||
            (r_ptr->flags1 & RF1_QUESTOR) || (r_ptr->level + randint1(50) > plev + randint1(60)))
        {
            msg_format("%^s is unaffected!", m_name);
        }
        else teleport_level(target_m_idx);
        break;
    }
    case MS_PSY_SPEAR:
        if (!get_aim_dir(&dir)) return FALSE;

            else msg_print("You throw a psycho-spear.");
        damage = randint1(plev * 3) + 100;
        (void)fire_beam(GF_PSY_SPEAR, dir, spell_power(damage));
        break;
    case MS_DARKNESS:
            msg_print("You gesture in shadow.");
        (void)unlite_area(10, 3);
        break;
    case MS_MAKE_TRAP:
        if (!target_set(TARGET_KILL)) return FALSE;
            msg_print("You cast a spell and cackle evilly.");
        trap_creation(target_row, target_col);
        break;
    case MS_FORGET:
            msg_print("Nothing happen.");
        break;
    case MS_RAISE_DEAD:
        msg_print("You cast a animate dead.");
        (void)animate_dead(0, py, px);
        break;
    case MS_S_KIN:
    {
        int k;
            msg_print("You summon minions.");
        for (k = 0;k < 1; k++)
        {
            if (summon_kin_player(summon_lev, py, px, (pet ? PM_FORCE_PET : 0L)))
            {
                if (!pet)
msg_print("Summoned fellows are angry!");
            }
            else
            {
                no_trump = TRUE;
            }
        }
        break;
    }
    case MS_S_CYBER:
    {
        int k;
            msg_print("You summon a Cyberdemon!");
        for (k = 0 ;k < 1 ; k++)
            if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_CYBER, p_mode))
            {
                if (!pet)
msg_print("The summoned Cyberdemon are angry!");
            }
            else
            {
                no_trump = TRUE;
            }
        break;
    }
    case MS_S_MONSTER:
    {
        int k;
            msg_print("You summon help.");
        for (k = 0;k < 1; k++)
            if (summon_specific((pet ? -1 : 0), py, px, summon_lev, 0, p_mode))
            {
                if (!pet)
msg_print("The summoned monster is angry!");
            }
            else
            {
                no_trump = TRUE;
            }
        break;
    }
    case MS_S_MONSTERS:
    {
        int k;
            msg_print("You summon monsters!");
        for (k = 0;k < plev / 15 + 2; k++)
            if(summon_specific((pet ? -1 : 0), py, px, summon_lev, 0, (p_mode | u_mode)))
            {
                if (!pet)
msg_print("Summoned monsters are angry!");
            }
            else
            {
                no_trump = TRUE;
            }
        break;
    }
    case MS_S_ANT:
    {
        int k;
            msg_print("You summon ants.");
        for (k = 0;k < 1; k++)
            if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_ANT, (PM_ALLOW_GROUP | p_mode)))
            {
                if (!pet)
msg_print("Summoned ants are angry!");
            }
            else
            {
                no_trump = TRUE;
            }
        break;
    }
    case MS_S_SPIDER:
    {
        int k;
            msg_print("You summon spiders.");
        for (k = 0;k < 1; k++)
            if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_SPIDER, (PM_ALLOW_GROUP | p_mode)))
            {
                if (!pet)
msg_print("Summoned spiders are angry!");
            }
            else
            {
                no_trump = TRUE;
            }
        break;
    }
    case MS_S_HOUND:
    {
        int k;
            msg_print("You summon hounds.");
        for (k = 0;k < 1; k++)
            if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HOUND, (PM_ALLOW_GROUP | p_mode)))
            {
                if (!pet)
msg_print("Summoned hounds are angry!");
            }
            else
            {
                no_trump = TRUE;
            }
        break;
    }
    case MS_S_HYDRA:
    {
        int k;
            msg_print("You summon a hydras.");
        for (k = 0;k < 1; k++)
            if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HYDRA, (g_mode | p_mode)))
            {
                if (!pet)
msg_print("Summoned hydras are angry!");
            }
            else
            {
                no_trump = TRUE;
            }
        break;
    }
    case MS_S_ANGEL:
    {
        int k;
            msg_print("You summon an angel!");
        for (k = 0;k < 1; k++)
            if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_ANGEL, (g_mode | p_mode)))
            {
                if (!pet)
msg_print("Summoned angels are angry!");
            }
            else
            {
                no_trump = TRUE;
            }
        break;
    }
    case MS_S_DEMON:
    {
        int k;
            msg_print("You summon a demon from the Courts of Chaos!");
        for (k = 0;k < 1; k++)
            if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_DEMON, (g_mode | p_mode)))
            {
                if (!pet)
msg_print("Summoned demons are angry!");
            }
            else
            {
                no_trump = TRUE;
            }
        break;
    }
    case MS_S_UNDEAD:
    {
        int k;
            msg_print("You summon an undead adversary!");
        for (k = 0;k < 1; k++)
            if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_UNDEAD, (g_mode | p_mode)))
            {
                if (!pet)
msg_print("Summoned undeads are angry!");
            }
            else
            {
                no_trump = TRUE;
            }
        break;
    }
    case MS_S_DRAGON:
    {
        int k;
            msg_print("You summon a dragon!");
        for (k = 0;k < 1; k++)
            if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_DRAGON, (g_mode | p_mode)))
            {
                if (!pet)
msg_print("Summoned dragons are angry!");
            }
            else
            {
                no_trump = TRUE;
            }
        break;
    }
    case MS_S_HI_UNDEAD:
    {
        int k;
            msg_print("You summon a greater undead!");
        for (k = 0;k < 1; k++)
            if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | u_mode)))
            {
                if (!pet)
msg_print("Summoned greater undeads are angry!");
            }
            else
            {
                no_trump = TRUE;
            }
        break;
    }
    case MS_S_HI_DRAGON:
    {
        int k;
            msg_print("You summon an ancient dragon!");
        for (k = 0;k < 1; k++)
            if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HI_DRAGON, (g_mode | p_mode | u_mode)))
            {
                if (!pet)
msg_print("Summoned ancient dragons are angry!");
            }
            else
            {
                no_trump = TRUE;
            }
        break;
    }
    case MS_S_AMBERITE:
    {
        int k;
            msg_print("You summon a Lord of Amber!");
        for (k = 0;k < 1; k++)
            if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_AMBERITE, (g_mode | p_mode | u_mode)))
            {
                if (!pet)
msg_print("Summoned Lords of Amber are angry!");
            }
            else
            {
                no_trump = TRUE;
            }
        break;
    }
    case MS_S_UNIQUE:
    {
        int k, count = 0;
            msg_print("You summon a special opponent!");
        for (k = 0;k < 1; k++)
            if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_UNIQUE, (g_mode | p_mode | PM_ALLOW_UNIQUE)))
            {
                count++;
                if (!pet)
msg_print("Summoned special opponents are angry!");
            }
        for (k = count;k < 1; k++)
            if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | PM_ALLOW_UNIQUE)))
            {
                count++;
                if (!pet)
msg_print("Summoned greater undeads are angry!");
            }
        if (!count)
        {
            no_trump = TRUE;
        }
        break;
    }
    default:
        msg_print("hoge?");
    }
    if (no_trump)
    {
msg_print("No one have appeared.");
    }

    return TRUE;
}
Example #13
0
/*!
 * @brief 青魔法の発動 /
 * do_cmd_cast calls this function if the player's class is 'blue-mage'.
 * @param spell 発動するモンスター攻撃のID
 * @param success TRUEは成功時、FALSEは失敗時の処理を行う
 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
 */
static bool cast_learned_spell(int spell, bool success)
{
	int             dir;
	int             plev = pseudo_plev();
	int     summon_lev = p_ptr->lev * 2 / 3 + randint1(p_ptr->lev/2);
	int             damage = 0;
	bool   pet = success;
	bool   no_trump = FALSE;
	u32b p_mode, u_mode = 0L, g_mode;

	if (pet)
	{
		p_mode = PM_FORCE_PET;
		g_mode = 0;
	}
	else
	{
		p_mode = PM_NO_PET;
		g_mode = PM_ALLOW_GROUP;
	}

	if (!success || (randint1(50+plev) < plev/10)) u_mode = PM_ALLOW_UNIQUE;

	/* spell code */
	switch (spell)
	{
	case MS_SHRIEK:
        msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
		aggravate_monsters(0);
		break;
	case MS_XXX1:
		break;
	case MS_DISPEL:
	{
		int m_idx;

		if (!target_set(TARGET_KILL)) return FALSE;
		m_idx = cave[target_row][target_col].m_idx;
		if (!m_idx) break;
		if (!player_has_los_bold(target_row, target_col)) break;
		if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
		dispel_monster_status(m_idx);
		break;
	}
	case MS_ROCKET:
		if (!get_aim_dir(&dir)) return FALSE;
		
        msg_print(_("ロケットを発射した。", "You fire a rocket."));
        damage = monspell_bluemage_damage((MS_ROCKET), plev, DAM_ROLL);
		fire_rocket(GF_ROCKET, dir, damage, 2);
		break;
	case MS_SHOOT:
	{
		if (!get_aim_dir(&dir)) return FALSE;
		
        msg_print(_("矢を放った。", "You fire an arrow."));
        damage = monspell_bluemage_damage((MS_SHOOT), plev, DAM_ROLL);
		fire_bolt(GF_ARROW, dir, damage);
		break;
	}
	case MS_XXX2:
		break;
	case MS_XXX3:
		break;
	case MS_XXX4:
		break;
	case MS_BR_ACID:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
        damage = monspell_bluemage_damage((MS_BR_ACID), plev, DAM_ROLL);
		fire_ball(GF_ACID, dir, damage, (plev > 40 ? -3 : -2));
		break;
	case MS_BR_ELEC:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
        damage = monspell_bluemage_damage((MS_BR_ELEC), plev, DAM_ROLL);
		fire_ball(GF_ELEC, dir, damage, (plev > 40 ? -3 : -2));
		break;
	case MS_BR_FIRE:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
        damage = monspell_bluemage_damage((MS_BR_FIRE), plev, DAM_ROLL);
		fire_ball(GF_FIRE, dir, damage, (plev > 40 ? -3 : -2));
		break;
	case MS_BR_COLD:
        if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
        damage = monspell_bluemage_damage((MS_BR_COLD), plev, DAM_ROLL);
		fire_ball(GF_COLD, dir, damage, (plev > 40 ? -3 : -2));
		break;
	case MS_BR_POIS:
        if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
        damage = monspell_bluemage_damage((MS_BR_POIS), plev, DAM_ROLL);
		fire_ball(GF_POIS, dir, damage, (plev > 40 ? -3 : -2));
		break;
	case MS_BR_NETHER:
        if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
        damage = monspell_bluemage_damage((MS_BR_NETHER), plev, DAM_ROLL);
		fire_ball(GF_NETHER, dir, damage, (plev > 40 ? -3 : -2));
		break;
	case MS_BR_LITE:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
        damage = monspell_bluemage_damage((MS_BR_LITE), plev, DAM_ROLL);
		fire_ball(GF_LITE, dir, damage, (plev > 40 ? -3 : -2));
		break;
	case MS_BR_DARK:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
        damage = monspell_bluemage_damage((MS_BR_DARK), plev, DAM_ROLL);
		fire_ball(GF_DARK, dir, damage, (plev > 40 ? -3 : -2));
		break;
	case MS_BR_CONF:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
        damage = monspell_bluemage_damage((MS_BR_CONF), plev, DAM_ROLL);
		fire_ball(GF_CONFUSION, dir, damage, (plev > 40 ? -3 : -2));
		break;
	case MS_BR_SOUND:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
        damage = monspell_bluemage_damage((MS_BR_SOUND), plev, DAM_ROLL);
		fire_ball(GF_SOUND, dir, damage, (plev > 40 ? -3 : -2));
		break;
	case MS_BR_CHAOS:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
        damage = monspell_bluemage_damage((MS_BR_CHAOS), plev, DAM_ROLL);
		fire_ball(GF_CHAOS, dir, damage, (plev > 40 ? -3 : -2));
		break;
	case MS_BR_DISEN:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
        damage = monspell_bluemage_damage((MS_BR_DISEN), plev, DAM_ROLL);
		fire_ball(GF_DISENCHANT, dir, damage, (plev > 40 ? -3 : -2));
		break;
	case MS_BR_NEXUS:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
        damage = monspell_bluemage_damage((MS_BR_NEXUS), plev, DAM_ROLL);
		fire_ball(GF_NEXUS, dir, damage, (plev > 40 ? -3 : -2));
		break;
	case MS_BR_TIME:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
        damage = monspell_bluemage_damage((MS_BR_TIME), plev, DAM_ROLL);
		fire_ball(GF_TIME, dir, damage, (plev > 40 ? -3 : -2));
		break;
	case MS_BR_INERTIA:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
        damage = monspell_bluemage_damage((MS_BR_INERTIA), plev, DAM_ROLL);
		fire_ball(GF_INERTIAL, dir, damage, (plev > 40 ? -3 : -2));
		break;
	case MS_BR_GRAVITY:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
        damage = monspell_bluemage_damage((MS_BR_GRAVITY), plev, DAM_ROLL);
		fire_ball(GF_GRAVITY, dir, damage, (plev > 40 ? -3 : -2));
		break;
	case MS_BR_SHARDS:
        if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
        damage = monspell_bluemage_damage((MS_BR_SHARDS), plev, DAM_ROLL);
		fire_ball(GF_SHARDS, dir, damage, (plev > 40 ? -3 : -2));
		break;
	case MS_BR_PLASMA:
        if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
        damage = monspell_bluemage_damage((MS_BR_PLASMA), plev, DAM_ROLL);
		fire_ball(GF_PLASMA, dir, damage, (plev > 40 ? -3 : -2));
		break;
	case MS_BR_FORCE:
        if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
        damage = monspell_bluemage_damage((MS_BR_FORCE), plev, DAM_ROLL);
		fire_ball(GF_FORCE, dir, damage, (plev > 40 ? -3 : -2));
		break;
	case MS_BR_MANA:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
        damage = monspell_bluemage_damage((MS_BR_MANA), plev, DAM_ROLL);
		fire_ball(GF_MANA, dir, damage, (plev > 40 ? -3 : -2));
		break;
	case MS_BALL_NUKE:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("放射能球を放った。", "You cast a ball of radiation."));
        damage = monspell_bluemage_damage((MS_BALL_NUKE), plev, DAM_ROLL);
		fire_ball(GF_NUKE, dir, damage, 2);
		break;
	case MS_BR_NUKE:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
        damage = monspell_bluemage_damage((MS_BR_NUKE), plev, DAM_ROLL);
		fire_ball(GF_NUKE, dir, damage, (plev > 40 ? -3 : -2));
		break;
	case MS_BALL_CHAOS:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("純ログルスを放った。", "You invoke a raw Logrus."));
        damage = monspell_bluemage_damage((MS_BALL_CHAOS), plev, DAM_ROLL);
		fire_ball(GF_CHAOS, dir, damage, 4);
		break;
	case MS_BR_DISI:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
        damage = monspell_bluemage_damage((MS_BR_DISI), plev, DAM_ROLL);
		fire_ball(GF_DISINTEGRATE, dir, damage, (plev > 40 ? -3 : -2));
		break;
	case MS_BALL_ACID:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball."));
        damage = monspell_bluemage_damage((MS_BALL_ACID), plev, DAM_ROLL);
		fire_ball(GF_ACID, dir, damage, 2);
		break;
	case MS_BALL_ELEC:
        if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball."));
        damage = monspell_bluemage_damage((MS_BALL_ELEC), plev, DAM_ROLL);
		fire_ball(GF_ELEC, dir, damage, 2);
		break;
	case MS_BALL_FIRE:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball."));
        damage = monspell_bluemage_damage((MS_BALL_FIRE), plev, DAM_ROLL);
		fire_ball(GF_FIRE, dir, damage, 2);
		break;
	case MS_BALL_COLD:
        if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball."));
        damage = monspell_bluemage_damage((MS_BALL_COLD), plev, DAM_ROLL);
		fire_ball(GF_COLD, dir, damage, 2);
		break;
	case MS_BALL_POIS:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud."));
        damage = monspell_bluemage_damage((MS_BALL_POIS), plev, DAM_ROLL);
		fire_ball(GF_POIS, dir, damage, 2);
		break;
	case MS_BALL_NETHER:
        if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball."));
        damage = monspell_bluemage_damage((MS_BALL_NETHER), plev, DAM_ROLL);
		fire_ball(GF_NETHER, dir, damage, 2);
		break;
	case MS_BALL_WATER:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("流れるような身振りをした。", "You gesture fluidly."));
        damage = monspell_bluemage_damage((MS_BALL_WATER), plev, DAM_ROLL);
		fire_ball(GF_WATER, dir, damage, 4);
		break;
	case MS_BALL_MANA:
        if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm."));
        damage = monspell_bluemage_damage((MS_BALL_MANA), plev, DAM_ROLL);
		fire_ball(GF_MANA, dir, damage, 4);
		break;
	case MS_BALL_DARK:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm."));
        damage = monspell_bluemage_damage((MS_BALL_DARK), plev, DAM_ROLL);
		fire_ball(GF_DARK, dir, damage, 4);
		break;
	case MS_DRAIN_MANA:
		if (!get_aim_dir(&dir)) return FALSE;

        damage = monspell_bluemage_damage((MS_DRAIN_MANA), plev, DAM_ROLL);
        fire_ball_hide(GF_DRAIN_MANA, dir, damage, 0);
		break;
	case MS_MIND_BLAST:
		if (!get_aim_dir(&dir)) return FALSE;

        damage = monspell_bluemage_damage((MS_MIND_BLAST), plev, DAM_ROLL);
		fire_ball_hide(GF_MIND_BLAST, dir, damage, 0);
		break;
	case MS_BRAIN_SMASH:
        if (!get_aim_dir(&dir)) return FALSE;

        damage = monspell_bluemage_damage((MS_BRAIN_SMASH), plev, DAM_ROLL);
		fire_ball_hide(GF_BRAIN_SMASH, dir, damage, 0);
		break;
	case MS_CAUSE_1:
		if (!get_aim_dir(&dir)) return FALSE;

        damage = monspell_bluemage_damage((MS_CAUSE_1), plev, DAM_ROLL);
		fire_ball_hide(GF_CAUSE_1, dir, damage, 0);
		break;
	case MS_CAUSE_2:
		if (!get_aim_dir(&dir)) return FALSE;

        damage = monspell_bluemage_damage((MS_CAUSE_2), plev, DAM_ROLL);
		fire_ball_hide(GF_CAUSE_2, dir, damage, 0);
		break;
	case MS_CAUSE_3:
		if (!get_aim_dir(&dir)) return FALSE;

        damage = monspell_bluemage_damage((MS_CAUSE_3), plev, DAM_ROLL);
		fire_ball_hide(GF_CAUSE_3, dir, damage, 0);
		break;
	case MS_CAUSE_4:
		if (!get_aim_dir(&dir)) return FALSE;

        damage = monspell_bluemage_damage((MS_CAUSE_4), plev, DAM_ROLL);
		fire_ball_hide(GF_CAUSE_4, dir, damage, 0);
		break;
	case MS_BOLT_ACID:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt."));
        damage = monspell_bluemage_damage((MS_BOLT_ACID), plev, DAM_ROLL);
        fire_bolt(GF_ACID, dir, damage);
		break;
	case MS_BOLT_ELEC:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt."));
        damage = monspell_bluemage_damage((MS_BOLT_ELEC), plev, DAM_ROLL);
		fire_bolt(GF_ELEC, dir, damage);
		break;
	case MS_BOLT_FIRE:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt."));
        damage = monspell_bluemage_damage((MS_BOLT_FIRE), plev, DAM_ROLL);
		fire_bolt(GF_FIRE, dir, damage);
		break;
	case MS_BOLT_COLD:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt."));
        damage = monspell_bluemage_damage((MS_BOLT_COLD), plev, DAM_ROLL);
		fire_bolt(GF_COLD, dir, damage);
		break;
	case MS_STARBURST:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst."));
        damage = monspell_bluemage_damage((MS_STARBURST), plev, DAM_ROLL);
		fire_ball(GF_LITE, dir, damage, 4);
		break;
	case MS_BOLT_NETHER:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt."));
        damage = monspell_bluemage_damage((MS_BOLT_NETHER), plev, DAM_ROLL);
		fire_bolt(GF_NETHER, dir, damage);
		break;
	case MS_BOLT_WATER:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt."));
        damage = monspell_bluemage_damage((MS_BOLT_WATER), plev, DAM_ROLL);
		fire_bolt(GF_WATER, dir, damage);
		break;
	case MS_BOLT_MANA:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt."));
        damage = monspell_bluemage_damage((MS_BOLT_MANA), plev, DAM_ROLL);
		fire_bolt(GF_MANA, dir, damage);
		break;
	case MS_BOLT_PLASMA:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt."));
        damage = monspell_bluemage_damage((MS_BOLT_PLASMA), plev, DAM_ROLL);
		fire_bolt(GF_PLASMA, dir, damage);
		break;
	case MS_BOLT_ICE:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt."));
        damage = monspell_bluemage_damage((MS_BOLT_ICE), plev, DAM_ROLL);
		fire_bolt(GF_ICE, dir, damage);
		break;
	case MS_MAGIC_MISSILE:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile."));
        damage = monspell_bluemage_damage((MS_MAGIC_MISSILE), plev, DAM_ROLL);
		fire_bolt(GF_MISSILE, dir, damage);
		break;
	case MS_SCARE:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion."));
		fear_monster(dir, plev+10);
		break;
	case MS_BLIND:
		if (!get_aim_dir(&dir)) return FALSE;
		confuse_monster(dir, plev * 2);
		break;
	case MS_CONF:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion."));
		confuse_monster(dir, plev * 2);
		break;
	case MS_SLOW:
		if (!get_aim_dir(&dir)) return FALSE;
		slow_monster(dir, plev);
		break;
	case MS_SLEEP:
		if (!get_aim_dir(&dir)) return FALSE;
		sleep_monster(dir, plev);
		break;
	case MS_SPEED:
		(void)set_fast(randint1(20 + plev) + plev, FALSE);
		break;
	case MS_HAND_DOOM:
	{
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
		fire_ball_hide(GF_HAND_DOOM, dir, plev * 3, 0);
		break;
	}
	case MS_HEAL:
        msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
		(void)hp_player(plev*4);
		(void)set_stun(0);
		(void)set_cut(0);
		break;
	case MS_INVULNER:
        msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
		(void)set_invuln(randint1(4) + 4, FALSE);
		break;
	case MS_BLINK:
		teleport_player(10, 0L);
		break;
	case MS_TELEPORT:
		teleport_player(plev * 5, 0L);
		break;
	case MS_WORLD:
        world_player = TRUE;
        msg_print(_("「時よ!」", "'Time!'"));
		msg_print(NULL);

		/* Hack */
		p_ptr->energy_need -= 1000 + (100 + randint1(200)+200)*TURNS_PER_TICK/10;

		/* Redraw map */
		p_ptr->redraw |= (PR_MAP);

		/* Update monsters */
		p_ptr->update |= (PU_MONSTERS);

		/* Window stuff */
		p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);

		handle_stuff();
		break;
	case MS_SPECIAL:
		break;
	case MS_TELE_TO:
	{
		monster_type *m_ptr;
		monster_race *r_ptr;
		char m_name[80];

		if (!target_set(TARGET_KILL)) return FALSE;
		if (!cave[target_row][target_col].m_idx) break;
		if (!player_has_los_bold(target_row, target_col)) break;
		if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
		m_ptr = &m_list[cave[target_row][target_col].m_idx];
		r_ptr = &r_info[m_ptr->r_idx];
		monster_desc(m_name, m_ptr, 0);
		if (r_ptr->flagsr & RFR_RES_TELE)
		{
			if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
			{
				if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
                msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
				break;
			}
			else if (r_ptr->level > randint1(100))
			{
				if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
                msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
				break;
			}
		}
        msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
		teleport_monster_to(cave[target_row][target_col].m_idx, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE);
		break;
	}
	case MS_TELE_AWAY:
		if (!get_aim_dir(&dir)) return FALSE;

		(void)fire_beam(GF_AWAY_ALL, dir, 100);
		break;
	case MS_TELE_LEVEL:
	{
		int target_m_idx;
		monster_type *m_ptr;
		monster_race *r_ptr;
		char m_name[80];

		if (!target_set(TARGET_KILL)) return FALSE;
		target_m_idx = cave[target_row][target_col].m_idx;
		if (!target_m_idx) break;
		if (!player_has_los_bold(target_row, target_col)) break;
		if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
		m_ptr = &m_list[target_m_idx];
		r_ptr = &r_info[m_ptr->r_idx];
		monster_desc(m_name, m_ptr, 0);
        msg_format(_("%^sの足を指さした。", "You gesture at %^s's feet."), m_name);

		if ((r_ptr->flagsr & (RFR_EFF_RES_NEXU_MASK | RFR_RES_TELE)) ||
			(r_ptr->flags1 & RF1_QUESTOR) || (r_ptr->level + randint1(50) > plev + randint1(60)))
		{
            msg_format(_("しかし効果がなかった!", "%^s is unaffected!"), m_name);
		}
		else teleport_level(target_m_idx);
		break;
	}
	case MS_PSY_SPEAR:
		if (!get_aim_dir(&dir)) return FALSE;

        msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
        damage = monspell_bluemage_damage((MS_PSY_SPEAR), plev, DAM_ROLL);
		(void)fire_beam(GF_PSY_SPEAR, dir, damage);
		break;
	case MS_DARKNESS:

        msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
		(void)unlite_area(10, 3);
		break;
	case MS_MAKE_TRAP:
		if (!target_set(TARGET_KILL)) return FALSE;

        msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackle evilly."));
		trap_creation(target_row, target_col);
		break;
	case MS_FORGET:
        msg_print(_("しかし何も起きなかった。", "Nothing happen."));
		break;
    case MS_RAISE_DEAD:
        msg_print(_("死者復活の呪文を唱えた。", "You cast a animate dead."));
		(void)animate_dead(0, p_ptr->y, p_ptr->x);
		break;
	case MS_S_KIN:
	{
		int k;

        msg_print(_("援軍を召喚した。", "You summon minions."));
		for (k = 0;k < 1; k++)
		{
			if (summon_kin_player(summon_lev, p_ptr->y, p_ptr->x, (pet ? PM_FORCE_PET : 0L)))
			{
				if (!pet) msg_print(_("召喚された仲間は怒っている!", "Summoned fellows are angry!"));
			}
			else
			{
				no_trump = TRUE;
			}
		}
		break;
	}
	case MS_S_CYBER:
	{
		int k;

        msg_print(_("サイバーデーモンを召喚した!", "You summon a Cyberdemon!"));
		for (k = 0 ;k < 1 ; k++)
			if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_CYBER, p_mode))
			{
                if (!pet)
                    msg_print(_("召喚されたサイバーデーモンは怒っている!", "The summoned Cyberdemon are angry!"));
			}
			else
			{
				no_trump = TRUE;
			}
		break;
	}
	case MS_S_MONSTER:
	{
		int k;
        msg_print(_("仲間を召喚した。", "You summon help."));
		for (k = 0;k < 1; k++)
			if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, 0, p_mode))
			{
                if (!pet)
                    msg_print(_("召喚されたモンスターは怒っている!", "The summoned monster is angry!"));
			}
			else
			{
				no_trump = TRUE;
			}
		break;
	}
	case MS_S_MONSTERS:
	{
		int k;
        msg_print(_("モンスターを召喚した!", "You summon monsters!"));
		for (k = 0;k < plev / 15 + 2; k++)
			if(summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, 0, (p_mode | u_mode)))
			{
                if (!pet)
                    msg_print(_("召喚されたモンスターは怒っている!", "The summoned monsters are angry!"));
			}
			else
			{
				no_trump = TRUE;
			}
		break;
	}
	case MS_S_ANT:
	{
		int k;
        msg_print(_("アリを召喚した。", "You summon ants."));
		for (k = 0;k < 1; k++)
			if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_ANT, (PM_ALLOW_GROUP | p_mode)))
			{
                if (!pet)
                    msg_print(_("召喚されたアリは怒っている!", "The summoned ants are angry!"));
			}
			else
			{
				no_trump = TRUE;
			}
		break;
	}
	case MS_S_SPIDER:
	{
		int k;
        msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
		for (k = 0;k < 1; k++)
			if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_SPIDER, (PM_ALLOW_GROUP | p_mode)))
			{
                if (!pet)
                    msg_print(_("召喚された蜘蛛は怒っている!", "Summoned spiders are angry!"));
			}
			else
			{
				no_trump = TRUE;
			}
		break;
	}
	case MS_S_HOUND:
	{
		int k;
        msg_print(_("ハウンドを召喚した。", "You summon hounds."));
		for (k = 0;k < 1; k++)
			if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HOUND, (PM_ALLOW_GROUP | p_mode)))
			{
                if (!pet)
                    msg_print(_("召喚されたハウンドは怒っている!", "Summoned hounds are angry!"));
			}
			else
			{
				no_trump = TRUE;
			}
		break;
	}
	case MS_S_HYDRA:
	{
		int k;
        msg_print(_("ヒドラを召喚した。", "You summon a hydras."));
		for (k = 0;k < 1; k++)
			if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HYDRA, (g_mode | p_mode)))
			{
                if (!pet)
                    msg_print(_("召喚されたヒドラは怒っている!", "Summoned hydras are angry!"));
			}
			else
			{
				no_trump = TRUE;
			}
		break;
	}
	case MS_S_ANGEL:
	{
		int k;
        msg_print(_("天使を召喚した!", "You summon an angel!"));
		for (k = 0;k < 1; k++)
			if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_ANGEL, (g_mode | p_mode)))
			{
                if (!pet)
                    msg_print(_("召喚された天使は怒っている!", "Summoned angels are angry!"));
			}
			else
			{
				no_trump = TRUE;
			}
		break;
	}
	case MS_S_DEMON:
	{
		int k;
        msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
		for (k = 0;k < 1; k++)
			if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_DEMON, (g_mode | p_mode)))
			{
                if (!pet)
                    msg_print(_("召喚されたデーモンは怒っている!", "Summoned demons are angry!"));
			}
			else
			{
				no_trump = TRUE;
			}
		break;
	}
	case MS_S_UNDEAD:
	{
		int k;
        msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
		for (k = 0;k < 1; k++)
			if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_UNDEAD, (g_mode | p_mode)))
			{
                if (!pet)
                    msg_print(_("召喚されたアンデッドは怒っている!", "Summoned undeads are angry!"));
			}
			else
			{
				no_trump = TRUE;
			}
		break;
	}
	case MS_S_DRAGON:
	{
		int k;
        msg_print(_("ドラゴンを召喚した!", "You summon a dragon!"));
		for (k = 0;k < 1; k++)
			if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_DRAGON, (g_mode | p_mode)))
			{
                if (!pet)
                    msg_print(_("召喚されたドラゴンは怒っている!", "Summoned dragons are angry!"));
			}
			else
			{
				no_trump = TRUE;
			}
		break;
	}
	case MS_S_HI_UNDEAD:
	{
		int k;
        msg_print(_("強力なアンデッドを召喚した!", "You summon a greater undead!"));
		for (k = 0;k < 1; k++)
			if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | u_mode)))
			{
                if (!pet)
                    msg_print(_("召喚された上級アンデッドは怒っている!", "Summoned greater undeads are angry!"));
			}
			else
			{
				no_trump = TRUE;
			}
		break;
	}
	case MS_S_HI_DRAGON:
	{
		int k;
        msg_print(_("古代ドラゴンを召喚した!", "You summon an ancient dragon!"));
		for (k = 0;k < 1; k++)
			if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HI_DRAGON, (g_mode | p_mode | u_mode)))
			{
                if (!pet)
                    msg_print(_("召喚された古代ドラゴンは怒っている!", "Summoned ancient dragons are angry!"));
			}
			else
			{
				no_trump = TRUE;
			}
		break;
	}
	case MS_S_AMBERITE:
	{
		int k;
        msg_print(_("アンバーの王族を召喚した!", "You summon a Lord of Amber!"));
		for (k = 0;k < 1; k++)
			if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_AMBERITES, (g_mode | p_mode | u_mode)))
			{
                if (!pet)
                    msg_print(_("召喚されたアンバーの王族は怒っている!", "Summoned Lords of Amber are angry!"));
			}
			else
			{
				no_trump = TRUE;
			}
		break;
	}
	case MS_S_UNIQUE:
	{
		int k, count = 0;
		msg_print(_("特別な強敵を召喚した!", "You summon a special opponent!"));
		for (k = 0;k < 1; k++)
			if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_UNIQUE, (g_mode | p_mode | PM_ALLOW_UNIQUE)))
			{
				count++;
				if (!pet)
					msg_print(_("召喚されたユニーク・モンスターは怒っている!", "Summoned special opponents are angry!"));
			}
		for (k = count;k < 1; k++)
			if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | PM_ALLOW_UNIQUE)))
			{
				count++;
				if (!pet)
					msg_print(_("召喚された上級アンデッドは怒っている!", "Summoned greater undeads are angry!"));
			}
		if (!count)
		{
			no_trump = TRUE;
		}
		break;
	}
	default:
		msg_print("hoge?");
	}
	if (no_trump)
    {
        msg_print(_("何も現れなかった。", "No one have appeared."));
	}

	return TRUE;
}
Example #14
0
/*
 * Activate a wielded object.  Wielded objects never stack.
 * And even if they did, activatable objects never stack.
 *
 * Currently, only (some) artifacts, and Dragon Scale Mail, can be activated.
 * But one could, for example, easily make an activatable "Ring of Plasma".
 *
 * Note that it always takes a turn to activate an artifact, even if
 * the user hits "escape" at the "direction" prompt.
 */
static bool activate_object(object_type *o_ptr, bool *ident)
{
	int k, dir, i, chance;


	/* Check the recharge */
	if (o_ptr->timeout)
	{
		msg_print("It whines, glows and fades...");
		return FALSE;
	}

	/* Activate the artifact */
	message(MSG_ZAP, 0, "You activate it...");

	/* Artifacts */
	if (o_ptr->name1)
	{
		artifact_type *a_ptr = &a_info[o_ptr->name1];
		char o_name[80];

		/* Get the basic name of the object */
		object_desc(o_name, sizeof(o_name), o_ptr, FALSE, 0);

		switch (a_ptr->activation)
		{
			case ACT_ILLUMINATION:
			{
				msg_format("The %s wells with clear light...", o_name);
				lite_area(damroll(2, 15), 3);
				break;
			}

			case ACT_MAGIC_MAP:
			{
				msg_format("The %s shines brightly...", o_name);
				map_area();
				break;
			}

			case ACT_CLAIRVOYANCE:
			{
				msg_format("The %s glows a deep green...", o_name);
				wiz_lite();
				(void)detect_traps();
				(void)detect_doors();
				(void)detect_stairs();
				break;
			}

			case ACT_PROT_EVIL:
			{
				msg_format("The %s lets out a shrill wail...", o_name);
				k = 3 * p_ptr->lev;
				(void)set_protevil(p_ptr->protevil + randint(25) + k);
				break;
			}

			case ACT_DISP_EVIL:
			{
				msg_format("The %s floods the area with goodness...", o_name);
				dispel_evil(p_ptr->lev * 5);
				break;
			}

			case ACT_HASTE2:
			{
				msg_format("The %s glows brightly...", o_name);
				if (!p_ptr->fast)
				{
					(void)set_fast(randint(75) + 75);
				}
				else
				{
					(void)set_fast(p_ptr->fast + 5);
				}
				break;
			}

			case ACT_FIRE3:
			{
				msg_format("The %s glows deep red...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_ball(GF_FIRE, dir, 120, 3);
				break;
			}

			case ACT_FROST5:
			{
				msg_format("The %s glows bright white...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_ball(GF_COLD, dir, 200, 3);
				break;
			}

			case ACT_ELEC2:
			{
				msg_format("The %s glows deep blue...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_ball(GF_ELEC, dir, 250, 3);
				break;
			}

			case ACT_BIZZARE:
			{
				msg_format("The %s glows intensely black...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				ring_of_power(dir);
				break;
			}


			case ACT_STAR_BALL:
			{
				msg_format("Your %s is surrounded by lightning...", o_name);
				for (i = 0; i < 8; i++) fire_ball(GF_ELEC, ddd[i], 150, 3);
				break;
			}

			case ACT_RAGE_BLESS_RESIST:
			{
				msg_format("Your %s glows many colours...", o_name);
				(void)hp_player(30);
				(void)set_afraid(0);
				(void)set_shero(p_ptr->shero + randint(50) + 50);
				(void)set_blessed(p_ptr->blessed + randint(50) + 50);
				(void)set_oppose_acid(p_ptr->oppose_acid + randint(50) + 50);
				(void)set_oppose_elec(p_ptr->oppose_elec + randint(50) + 50);
				(void)set_oppose_fire(p_ptr->oppose_fire + randint(50) + 50);
				(void)set_oppose_cold(p_ptr->oppose_cold + randint(50) + 50);
				(void)set_oppose_pois(p_ptr->oppose_pois + randint(50) + 50);
				break;
			}

			case ACT_HEAL2:
			{
				msg_format("Your %s glows a bright white...", o_name);
				msg_print("You feel much better...");
				(void)hp_player(1000);
				(void)set_cut(0);
				break;
			}

			case ACT_PHASE:
			{
				msg_format("Your %s twists space around you...", o_name);
				teleport_player(10);
				break;
			}

			case ACT_BANISHMENT:
			{
				msg_format("Your %s glows deep blue...", o_name);
				(void)banishment();
				break;
			}

			case ACT_TRAP_DOOR_DEST:
			{
				msg_format("Your %s glows bright red...", o_name);
				destroy_doors_touch();
				break;
			}

			case ACT_DETECT:
			{
				msg_format("Your %s glows bright white...", o_name);
				msg_print("An image forms in your mind...");
				detect_all();
				break;
			}

			case ACT_HEAL1:
			{
				msg_format("Your %s glows deep blue...", o_name);
				msg_print("You feel a warm tingling inside...");
				(void)hp_player(500);
				(void)set_cut(0);
				break;
			}

			case ACT_RESIST:
			{
				msg_format("Your %s glows many colours...", o_name);
				(void)set_oppose_acid(p_ptr->oppose_acid + randint(20) + 20);
				(void)set_oppose_elec(p_ptr->oppose_elec + randint(20) + 20);
				(void)set_oppose_fire(p_ptr->oppose_fire + randint(20) + 20);
				(void)set_oppose_cold(p_ptr->oppose_cold + randint(20) + 20);
				(void)set_oppose_pois(p_ptr->oppose_pois + randint(20) + 20);
				break;
			}

			case ACT_SLEEP:
			{
				msg_format("Your %s glows deep blue...", o_name);
				sleep_monsters_touch();
				break;
			}

			case ACT_RECHARGE1:
			{
				msg_format("Your %s glows bright yellow...", o_name);
				recharge(60);
				break;
			}

			case ACT_TELEPORT:
			{
				msg_format("Your %s twists space around you...", o_name);
				teleport_player(100);
				break;
			}

			case ACT_RESTORE_LIFE:
			{
				msg_format("Your %s glows a deep red...", o_name);
				restore_level();
				break;
			}

			case ACT_MISSILE:
			{
				msg_format("Your %s glows extremely brightly...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_bolt(GF_MISSILE, dir, damroll(2, 6));
				break;
			}

			case ACT_FIRE1:
			{
				msg_format("Your %s is covered in fire...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_bolt(GF_FIRE, dir, damroll(9, 8));
				break;
			}

			case ACT_FROST1:
			{
				msg_format("Your %s is covered in frost...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_bolt(GF_COLD, dir, damroll(6, 8));
				break;
			}

			case ACT_LIGHTNING_BOLT:
			{
				msg_format("Your %s is covered in sparks...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_bolt(GF_ELEC, dir, damroll(4, 8));
				break;
			}

			case ACT_ACID1:
			{
				msg_format("Your %s is covered in acid...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_bolt(GF_ACID, dir, damroll(5, 8));
				break;
			}

			case ACT_ARROW:
			{
				msg_format("Your %s grows magical spikes...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_bolt(GF_ARROW, dir, 150);
				break;
			}

			case ACT_HASTE1:
			{
				msg_format("Your %s glows bright green...", o_name);
				if (!p_ptr->fast)
				{
					(void)set_fast(randint(20) + 20);
				}
				else
				{
					(void)set_fast(p_ptr->fast + 5);
				}
				break;
			}

			case ACT_REM_FEAR_POIS:
			{
				msg_format("Your %s glows deep blue...", o_name);
				(void)set_afraid(0);
				(void)set_poisoned(0);
				break;
			}

			case ACT_STINKING_CLOUD:
			{
				msg_format("Your %s throbs deep green...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_ball(GF_POIS, dir, 12, 3);
				break;
			}

			case ACT_FROST2:
			{
				msg_format("Your %s is covered in frost...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_ball(GF_COLD, dir, 48, 2);
				break;
			}

			case ACT_FROST4:
			{
				msg_format("Your %s glows a pale blue...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_bolt(GF_COLD, dir, damroll(12, 8));
				break;
			}

			case ACT_FROST3:
			{
				msg_format("Your %s glows a intense blue...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_ball(GF_COLD, dir, 100, 2);
				break;
			}

			case ACT_FIRE2:
			{
				msg_format("Your %s rages in fire...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_ball(GF_FIRE, dir, 72, 2);
				break;
			}

			case ACT_DRAIN_LIFE2:
			{
				msg_format("Your %s glows black...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				drain_life(dir, 120);
				break;
			}

			case ACT_STONE_TO_MUD:
			{
				msg_format("Your %s pulsates...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				wall_to_mud(dir);
				break;
			}

			case ACT_MASS_BANISHMENT:
			{
				msg_format("Your %s lets out a long, shrill note...", o_name);
				(void)mass_banishment();
				break;
			}

			case ACT_CURE_WOUNDS:
			{
				msg_format("Your %s radiates deep purple...", o_name);
				hp_player(damroll(4, 8));
				(void)set_cut((p_ptr->cut / 2) - 50);
				break;
			}

			case ACT_TELE_AWAY:
			{
				msg_format("Your %s glows deep red...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				teleport_monster(dir);
				break;
			}

			case ACT_WOR:
			{
				msg_format("Your %s glows soft white...", o_name);
				set_recall();
				break;
			}

			case ACT_CONFUSE:
			{
				msg_format("Your %s glows in scintillating colours...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				confuse_monster(dir, 20);
				break;
			}

			case ACT_IDENTIFY:
			{
				msg_format("Your %s glows yellow...", o_name);
				if (!ident_spell()) return FALSE;
				break;
			}

			case ACT_PROBE:
			{
				msg_format("Your %s glows brightly...", o_name);
				probing();
				break;
			}

			case ACT_DRAIN_LIFE1:
			{
				msg_format("Your %s glows white...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				drain_life(dir, 90);
				break;
			}

			case ACT_FIREBRAND:
			{
				msg_format("Your %s glows deep red...", o_name);
				(void)brand_bolts();
				break;
			}

			case ACT_STARLIGHT:
			{
				msg_format("Your %s glows with the light of a thousand stars...", o_name);
				for (k = 0; k < 8; k++) strong_lite_line(ddd[k]);
				break;
			}

			case ACT_MANA_BOLT:
			{
				msg_format("Your %s glows white...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_bolt(GF_MANA, dir, damroll(12, 8));
				break;
			}

			case ACT_BERSERKER:
			{
				msg_format("Your %s glows in anger...", o_name);
				set_shero(p_ptr->shero + randint(50) + 50);
				break;
			}
		}

		/* Set the recharge time */
		if (a_ptr->randtime)
			o_ptr->timeout = a_ptr->time + (byte)randint(a_ptr->randtime);
		else
			o_ptr->timeout = a_ptr->time;

		/* Window stuff */
		p_ptr->window |= (PW_INVEN | PW_EQUIP);

		/* Done */
		return FALSE;
	}


	/* Hack -- Dragon Scale Mail can be activated as well */
	if (o_ptr->tval == TV_DRAG_ARMOR)
	{
		/* Get a direction for breathing (or abort) */
		if (!get_aim_dir(&dir)) return FALSE;

		/* Branch on the sub-type */
		switch (o_ptr->sval)
		{
			case SV_DRAGON_BLUE:
			{
				msg_print("You breathe lightning.");
				fire_ball(GF_ELEC, dir, 100, 2);
				o_ptr->timeout = rand_int(450) + 450;
				break;
			}

			case SV_DRAGON_WHITE:
			{
				msg_print("You breathe frost.");
				fire_ball(GF_COLD, dir, 110, 2);
				o_ptr->timeout = rand_int(450) + 450;
				break;
			}

			case SV_DRAGON_BLACK:
			{
				msg_print("You breathe acid.");
				fire_ball(GF_ACID, dir, 130, 2);
				o_ptr->timeout = rand_int(450) + 450;
				break;
			}

			case SV_DRAGON_GREEN:
			{
				msg_print("You breathe poison gas.");
				fire_ball(GF_POIS, dir, 150, 2);
				o_ptr->timeout = rand_int(450) + 450;
				break;
			}

			case SV_DRAGON_RED:
			{
				msg_print("You breathe fire.");
				fire_ball(GF_FIRE, dir, 200, 2);
				o_ptr->timeout = rand_int(450) + 450;
				break;
			}

			case SV_DRAGON_MULTIHUED:
			{
				chance = rand_int(5);
				msg_format("You breathe %s.",
				           ((chance == 1) ? "lightning" :
				            ((chance == 2) ? "frost" :
				             ((chance == 3) ? "acid" :
				              ((chance == 4) ? "poison gas" : "fire")))));
				fire_ball(((chance == 1) ? GF_ELEC :
				           ((chance == 2) ? GF_COLD :
				            ((chance == 3) ? GF_ACID :
				             ((chance == 4) ? GF_POIS : GF_FIRE)))),
				          dir, 250, 2);
				o_ptr->timeout = rand_int(225) + 225;
				break;
			}

			case SV_DRAGON_BRONZE:
			{
				msg_print("You breathe confusion.");
				fire_ball(GF_CONFUSION, dir, 120, 2);
				o_ptr->timeout = rand_int(450) + 450;
				break;
			}

			case SV_DRAGON_GOLD:
			{
				msg_print("You breathe sound.");
				fire_ball(GF_SOUND, dir, 130, 2);
				o_ptr->timeout = rand_int(450) + 450;
				break;
			}

			case SV_DRAGON_CHAOS:
			{
				chance = rand_int(2);
				msg_format("You breathe %s.",
				           ((chance == 1 ? "chaos" : "disenchantment")));
				fire_ball((chance == 1 ? GF_CHAOS : GF_DISENCHANT),
				          dir, 220, 2);
				o_ptr->timeout = rand_int(300) + 300;
				break;
			}

			case SV_DRAGON_LAW:
			{
				chance = rand_int(2);
				msg_format("You breathe %s.",
				           ((chance == 1 ? "sound" : "shards")));
				fire_ball((chance == 1 ? GF_SOUND : GF_SHARD),
				          dir, 230, 2);
				o_ptr->timeout = rand_int(300) + 300;
				break;
			}

			case SV_DRAGON_BALANCE:
			{
				chance = rand_int(4);
				msg_format("You breathe %s.",
				           ((chance == 1) ? "chaos" :
				            ((chance == 2) ? "disenchantment" :
				             ((chance == 3) ? "sound" : "shards"))));
				fire_ball(((chance == 1) ? GF_CHAOS :
				           ((chance == 2) ? GF_DISENCHANT :
				            ((chance == 3) ? GF_SOUND : GF_SHARD))),
				          dir, 250, 2);
				o_ptr->timeout = rand_int(300) + 300;
				break;
			}

			case SV_DRAGON_SHINING:
			{
				chance = rand_int(2);
				msg_format("You breathe %s.",
				           ((chance == 0 ? "light" : "darkness")));
				fire_ball((chance == 0 ? GF_LITE : GF_DARK), dir, 200, 2);
				o_ptr->timeout = rand_int(300) + 300;
				break;
			}

			case SV_DRAGON_POWER:
			{
				msg_print("You breathe the elements.");
				fire_ball(GF_MISSILE, dir, 300, 2);
				o_ptr->timeout = rand_int(300) + 300;
				break;
			}
		}

		/* Window stuff */
		p_ptr->window |= (PW_INVEN | PW_EQUIP);

		/* Success */
		return FALSE;
	}

	/* Hack -- some Rings can be activated for double resist and element ball */
	if (o_ptr->tval == TV_RING)
	{
		/* Get a direction for firing (or abort) */
		if (!get_aim_dir(&dir)) return FALSE;

		/* Branch on the sub-type */
		switch (o_ptr->sval)
		{
			case SV_RING_ACID:
			{
				fire_ball(GF_ACID, dir, 70, 2);
				set_oppose_acid(p_ptr->oppose_acid + randint(20) + 20);
				o_ptr->timeout = rand_int(50) + 50;
				break;
			}

			case SV_RING_FLAMES:
			{
				fire_ball(GF_FIRE, dir, 80, 2);
				set_oppose_fire(p_ptr->oppose_fire + randint(20) + 20);
				o_ptr->timeout = rand_int(50) + 50;
				break;
			}

			case SV_RING_ICE:
			{
				fire_ball(GF_COLD, dir, 75, 2);
				set_oppose_cold(p_ptr->oppose_cold + randint(20) + 20);
				o_ptr->timeout = rand_int(50) + 50;
				break;
			}

			case SV_RING_LIGHTNING:
			{
				fire_ball(GF_ELEC, dir, 85, 2);
				set_oppose_elec(p_ptr->oppose_elec + randint(20) + 20);
				o_ptr->timeout = rand_int(50) + 50;
				break;
			}
		}

		/* Window stuff */
		p_ptr->window |= (PW_EQUIP);

		/* Success */
		return FALSE;
	}

	/* Mistake */
	msg_print("Oops.  That object cannot be activated.");

	/* Not used up */
	return (FALSE);
}
Example #15
0
/*
 * do_chase:
 *	Make one thing chase another.
 */
int
do_chase(THING *th)
{
    coord *cp;
    struct room *rer, *ree;	/* room of chaser, room of chasee */
    int mindist = 32767, curdist;
    int stoprun = FALSE;	/* TRUE means we are there */
    int door;
    THING *obj;
    coord this;			/* Temporary destination for chaser */

    rer = th->t_room;		/* Find room of chaser */
    if (on(*th, ISGREED) && rer->r_goldval == 0)
	th->t_dest = &hero;	/* If gold has been taken, run after hero */
    if (th->t_dest == &hero)	/* Find room of chasee */
	ree = proom;
    else
	ree = roomin(th->t_dest);
    /*
     * We don't count doors as inside rooms for this routine
     */
    door = (chat(th->t_pos.y, th->t_pos.x) == DOOR);
    /*
     * If the object of our desire is in a different room,
     * and we are not in a corridor, run to the door nearest to
     * our goal.
     */
over:
    if (rer != ree)
    {
	for (cp = rer->r_exit; cp < &rer->r_exit[rer->r_nexits]; cp++)
	{
	    curdist = dist_cp(th->t_dest, cp);
	    if (curdist < mindist)
	    {
		this = *cp;
		mindist = curdist;
	    }
	}
	if (door)
	{
	    rer = &passages[flat(th->t_pos.y, th->t_pos.x) & F_PNUM];
	    door = FALSE;
	    goto over;
	}
    }
    else
    {
	this = *th->t_dest;
	/*
	 * For dragons check and see if (a) the hero is on a straight
	 * line from it, and (b) that it is within shooting distance,
	 * but outside of striking range.
	 */
	if (th->t_type == 'D' && (th->t_pos.y == hero.y || th->t_pos.x == hero.x
	    || abs(th->t_pos.y - hero.y) == abs(th->t_pos.x - hero.x))
	    && dist_cp(&th->t_pos, &hero) <= BOLT_LENGTH * BOLT_LENGTH
	    && !on(*th, ISCANC) && rnd(DRAGONSHOT) == 0)
	{
	    delta.y = sign(hero.y - th->t_pos.y);
	    delta.x = sign(hero.x - th->t_pos.x);
	    if (has_hit)
		endmsg();
	    fire_bolt(&th->t_pos, &delta, "flame");
	    running = FALSE;
	    count = 0;
	    quiet = 0;
	    if (to_death && !on(*th, ISTARGET))
	    {
		to_death = FALSE;
		kamikaze = FALSE;
	    }
	    return(0);
	}
    }
    /*
     * This now contains what we want to run to this time
     * so we run to it.  If we hit it we either want to fight it
     * or stop running
     */
    if (!chase(th, &this))
    {
	if (ce(this, hero))
	{
	    return( attack(th) );
	}
	else if (ce(this, *th->t_dest))
	{
	    for (obj = lvl_obj; obj != NULL; obj = next(obj))
		if (th->t_dest == &obj->o_pos)
		{
		    detach(lvl_obj, obj);
		    attach(th->t_pack, obj);
		    chat(obj->o_pos.y, obj->o_pos.x) =
			(th->t_room->r_flags & ISGONE) ? PASSAGE : FLOOR;
		    th->t_dest = find_dest(th);
		    break;
		}
	    if (th->t_type != 'F')
		stoprun = TRUE;
	}
    }
    else
    {
	if (th->t_type == 'F')
	    return(0);
    }
    relocate(th, &ch_ret);
    /*
     * And stop running if need be
     */
    if (stoprun && ce(th->t_pos, *(th->t_dest)))
	th->t_flags &= ~ISRUN;
    return(0);
}
Example #16
0
Monster* fire_bolt(Coord start, Coord *dir, const std::string& name) {
    bool from_player(start == game->hero().position());
    return fire_bolt(start, dir, new MagicBolt(name, from_player)); //todo:who owns memory?
}
Example #17
0
static void cmd_racial_power_aux(const mutation_type *mut_ptr)
{
	s16b        plev = p_ptr->lev;
	int         dir = 0;

	if (racial_aux(mut_ptr->level, mut_ptr->cost, mut_ptr->stat, mut_ptr->diff))
	{
		switch (p_ptr->prace)
		{
			case RACE_DWARF:
			{
				msg_print("You examine your surroundings.");
				(void)detect_traps();
				(void)detect_doors();
				(void)detect_stairs();
				break;
			}

			case RACE_HOBBIT:
			{
				object_type *q_ptr;
				object_type forge;

				/* Get local object */
				q_ptr = &forge;

				/* Create the food ration */
				object_prep(q_ptr, 21);

				/* Drop the object from heaven */
				(void)drop_near(q_ptr, -1, p_ptr->py, p_ptr->px);
				msg_print("You cook some food.");

				break;
			}

			case RACE_GNOME:
			{
				msg_print("Blink!");
				teleport_player(10 + plev);
				break;
			}

			case RACE_HALF_ORC:
			{
				msg_print("You play tough.");
				(void)set_afraid(0);
				break;
			}

			case RACE_HALF_TROLL:
			{
				msg_print("RAAAGH!");
				if (!p_ptr->shero)
				{
					(void)hp_player(30);
				}
				(void)set_afraid(0);
				(void)set_shero(p_ptr->shero + 10 + randint1(plev));

				break;
			}

			case RACE_AMBERITE:
			{
				/* Hack - use levels to choose ability */
				if (mut_ptr->level == 30)
				{
					msg_print("You picture the Pattern in your mind and walk it...");
					(void)set_poisoned(0);
					(void)set_image(0);
					(void)set_stun(0);
					(void)set_cut(0);
					(void)set_blind(0);
					(void)set_afraid(0);
					(void)do_res_stat(A_STR, 200);
					(void)do_res_stat(A_INT, 200);
					(void)do_res_stat(A_WIS, 200);
					(void)do_res_stat(A_DEX, 200);
					(void)do_res_stat(A_CON, 200);
					(void)do_res_stat(A_CHR, 200);
					(void)restore_level();
				}

				else if (mut_ptr->level == 40)
				{
					/* No effect in arena or quest */
					if (p_ptr->inside_quest)
					{
						msg_print("There is no effect.");
					}
					else
					{
						msg_print("You start walking around. Your surroundings change.");

						if (autosave_l) do_cmd_save_game(TRUE);

						/* Leaving */
						p_ptr->leaving = TRUE;
					}
				}
				break;
			}

			case RACE_BARBARIAN:
			{
				msg_print("Raaagh!");
				if (!p_ptr->shero)
				{
					(void)hp_player(30);
				}

				(void)set_afraid(0);
				(void)set_shero(p_ptr->shero + 10 + randint1(plev));
				break;
			}

			case RACE_HALF_OGRE:
			{
				msg_print("You carefully set an explosive rune...");
				(void)explosive_rune();
				break;
			}

			case RACE_HALF_GIANT:
			{
				if (!get_aim_dir(&dir)) break;
				msg_print("You bash at a stone wall.");
				(void)wall_to_mud(dir);
				break;
			}

			case RACE_HALF_TITAN:
			{
				msg_print("You examine your foes...");
				(void)probing();
				break;
			}

			case RACE_CYCLOPS:
			{
				if (!get_aim_dir(&dir)) break;
				msg_print("You throw a huge boulder.");
				(void)fire_bolt(GF_MISSILE, dir, (3 * plev) / 2);
				break;
			}

			case RACE_YEEK:
			{
				if (!get_aim_dir(&dir)) break;
				msg_print("You make a horrible scream!");
				(void)fear_monster(dir, plev);
				break;
			}

			case RACE_KLACKON:
			{
				if (!get_aim_dir(&dir)) break;
				msg_print("You spit acid.");
				if (plev < 25)
					(void)fire_bolt(GF_ACID, dir, plev);
				else
					(void)fire_ball(GF_ACID, dir, plev, 2);
				break;
			}

			case RACE_KOBOLD:
			{
				if (!get_aim_dir(&dir)) break;
				msg_print("You throw a dart of poison.");
				(void)fire_bolt(GF_POIS, dir, plev);
				break;
			}

			case RACE_NIBELUNG:
			{
				msg_print("You examine your surroundings.");
				(void)detect_traps();
				(void)detect_doors();
				(void)detect_stairs();
				break;
			}

			case RACE_DARK_ELF:
			{
				if (!get_aim_dir(&dir)) break;
				msg_print("You cast a magic missile.");
				(void)fire_bolt_or_beam(10, GF_MISSILE, dir,
				    damroll(3 + ((plev - 1) / 5), 4));
				break;
			}

			case RACE_DRACONIAN:
			{
				int  Type = (one_in_(3) ? GF_COLD : GF_FIRE);
				cptr Type_desc = ((Type == GF_COLD) ? "cold" : "fire");

				if (randint1(100) < plev)
				{
					switch (p_ptr->pclass)
					{
						case CLASS_WARRIOR:
						case CLASS_RANGER:
							if (one_in_(3))
							{
								Type = GF_MISSILE;
								Type_desc = "the elements";
							}
							else
							{
								Type = GF_SHARDS;
								Type_desc = "shards";
							}
							break;
						case CLASS_MAGE:
						case CLASS_WARRIOR_MAGE:
						case CLASS_HIGH_MAGE:
							if (one_in_(3))
							{
								Type = GF_MANA;
								Type_desc = "mana";
							}
							else
							{
								Type = GF_DISENCHANT;
								Type_desc = "disenchantment";
							}
							break;
						case CLASS_CHAOS_WARRIOR:
							if (!one_in_(3))
							{
								Type = GF_CONFUSION;
								Type_desc = "confusion";
							}
							else
							{
								Type = GF_CHAOS;
								Type_desc = "chaos";
							}
							break;
						case CLASS_MONK:
							if (!one_in_(3))
							{
								Type = GF_CONFUSION;
								Type_desc = "confusion";
							}
							else
							{
								Type = GF_SOUND;
								Type_desc = "sound";
							}
							break;
						case CLASS_MINDCRAFTER:
							if (!one_in_(3))
							{
								Type = GF_CONFUSION;
								Type_desc = "confusion";
							}
							else
							{
								Type = GF_PSI;
								Type_desc = "mental energy";
							}
							break;
						case CLASS_PRIEST:
						case CLASS_PALADIN:
							if (one_in_(3))
							{
								Type = GF_HELL_FIRE;
								Type_desc = "hellfire";
							}
							else
							{
								Type = GF_HOLY_FIRE;
								Type_desc = "holy fire";
							}
							break;
						case CLASS_ROGUE:
							if (one_in_(3))
							{
								Type = GF_DARK;
								Type_desc = "darkness";
							}
							else
							{
								Type = GF_POIS;
								Type_desc = "poison";
							}
							break;
					}
				}

				if (!get_aim_dir(&dir)) break;
				msg_format("You breathe %s.", Type_desc);
				(void)fire_ball(Type, dir, plev * 2,
				    (plev / 15) + 1);
				break;
			}

			case RACE_MIND_FLAYER:
			{
				if (!get_aim_dir(&dir)) break;
				else
				{
					msg_print("You concentrate and your eyes glow red...");
					(void)fire_bolt(GF_PSI, dir, plev);
				}

				break;
			}

			case RACE_IMP:
			{
				if (!get_aim_dir(&dir)) break;
				if (plev >= 30)
				{
					msg_print("You cast a ball of fire.");
					(void)fire_ball(GF_FIRE, dir, plev, 2);
				}
				else
				{
					msg_print("You cast a bolt of fire.");
					(void)fire_bolt(GF_FIRE, dir, plev);
				}
				break;
			}

			case RACE_GOLEM:
			{
				(void)set_shield(p_ptr->shield + rand_range(30, 50));
				break;
			}

			case RACE_SKELETON:
			case RACE_ZOMBIE:
			{
				msg_print("You attempt to restore your lost energies.");
				(void)restore_level();
				break;
			}

			case RACE_VAMPIRE:
			{
				int y, x, dummy;
				cave_type *c_ptr;

				/* Only works on adjacent monsters */
				if (!get_rep_dir(&dir)) break;
				y = p_ptr->py + ddy[dir];
				x = p_ptr->px + ddx[dir];

				/* Paranoia */
				if (!in_bounds2(y, x)) break;

				c_ptr = area(y, x);

				if (!c_ptr->m_idx)
				{
					msg_print("You bite into thin air!");
					break;
				}

				msg_print("You grin and bare your fangs...");
				dummy = plev + randint1(plev) * MAX(1, plev / 10);   /* Dmg */
				if (drain_gain_life(dir, dummy))
				{
					/* Gain nutritional sustenance: 150/hp drained */
					/* A Food ration gives 5000 food points (by contrast) */
					/* Don't ever get more than "Full" this way */
					/* But if we ARE Gorged,  it won't cure us */
					dummy = p_ptr->food + MIN(5000, 100 * dummy);
					if (p_ptr->food < PY_FOOD_MAX)   /* Not gorged already */
						(void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
				}
				else
					msg_print("Yechh. That tastes foul.");
				break;
			}

			case RACE_SPECTRE:
			{
				msg_print("You emit an eldritch howl!");
				if (!get_aim_dir(&dir)) break;
				(void)fear_monster(dir, plev);
				break;
			}

			case RACE_SPRITE:
			{
				msg_print("You throw some magic dust...");
				if (plev < 25)
					(void)sleep_monsters_touch();
				else
					(void)sleep_monsters();
				break;
			}
			case RACE_GHOUL:
			{
				if (mut_ptr->level == 30)
				{
					/* Sense living */
					(void)detect_monsters_living();
				}
				else
				{
					eat_corpse();
				}
				break;
			}
			default:
				msg_print("This race has no bonus power.");
				p_ptr->energy_use = 0;
		}
	}

	/* Redraw mana and hp */
	p_ptr->redraw |= (PR_HP | PR_MANA);

	/* Window stuff */
	p_ptr->window |= (PW_PLAYER | PW_SPELL);
}
Example #18
0
/*
 * Do an effect, given an object.
 * Boost is the extent to which skill surpasses difficulty, used as % boost. It
 * ranges from 0 to 138.
 */
bool effect_do(effect_type effect, bool *ident, bool aware, int dir, int beam,
	int boost)
{
	int py = p_ptr->py;
	int px = p_ptr->px;
	int dam, chance, dur;

	if (effect < 1 || effect > EF_MAX)
	{
		msg("Bad effect passed to do_effect().  Please report this bug.");
		return FALSE;
	}

	switch (effect)
	{
		case EF_POISON:
		{
			inc_timed(TMD_POISONED, damroll(2, 7) + 10, TRUE, TRUE);
			*ident = TRUE;
			return TRUE;
		}

		case EF_BLIND:
		{
			inc_timed(TMD_BLIND, damroll(4, 25) + 75, TRUE, TRUE);
			*ident = TRUE;
			return TRUE;
		}

		case EF_SCARE:
		{
			inc_timed(TMD_AFRAID, randint0(10) + 10, TRUE, TRUE);
			*ident = TRUE;
			return TRUE;
		}

		case EF_CONFUSE:
		{
			inc_timed(TMD_CONFUSED, damroll(4, 5) + 10, TRUE, TRUE);
			*ident = TRUE;
			return TRUE;
		}

		case EF_HALLUC:
		{
			inc_timed(TMD_IMAGE, randint0(250) + 250, TRUE, TRUE);
			*ident = TRUE;
			return TRUE;
		}

		case EF_PARALYZE:
		{
			inc_timed(TMD_PARALYZED, randint0(5) + 5, TRUE, TRUE);
			*ident = TRUE;
			return TRUE;
		}

		case EF_SLOW:
		{
			if (inc_timed(TMD_SLOW, randint1(25) + 15, TRUE, TRUE))
				*ident = TRUE;
			return TRUE;
		}

		case EF_CURE_POISON:
		{
			if (clear_timed(TMD_POISONED, TRUE)) *ident = TRUE;
			return TRUE;
		}

		case EF_CURE_BLINDNESS:
		{
			if (clear_timed(TMD_BLIND, TRUE)) *ident = TRUE;
			return TRUE;
		}

		case EF_CURE_PARANOIA:
		{
			if (clear_timed(TMD_AFRAID, TRUE)) *ident = TRUE;
			return TRUE;
		}

		case EF_CURE_CONFUSION:
		{
			if (clear_timed(TMD_CONFUSED, TRUE)) *ident = TRUE;
			return TRUE;
		}

		case EF_CURE_MIND:
		{
			if (clear_timed(TMD_CONFUSED, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_AFRAID, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_IMAGE, TRUE)) *ident = TRUE;
			if (!of_has(p_ptr->state.flags, OF_RES_CONFU) &&
				inc_timed(TMD_OPP_CONF, damroll(4, 10), TRUE, TRUE))
			    	*ident = TRUE;
			return TRUE;
		}

		case EF_CURE_BODY:
		{
			if (clear_timed(TMD_STUN, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_CUT, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_POISONED, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_BLIND, TRUE)) *ident = TRUE;
			return TRUE;
		}


		case EF_CURE_LIGHT:
		{
			if (hp_player(20)) *ident = TRUE;
			if (clear_timed(TMD_BLIND, TRUE)) *ident = TRUE;
			if (dec_timed(TMD_CUT, 20, TRUE)) *ident = TRUE;
			if (dec_timed(TMD_CONFUSED, 20, TRUE)) *ident = TRUE;
			return TRUE;
		}

		case EF_CURE_SERIOUS:
		{
			if (hp_player(40)) *ident = TRUE;
			if (clear_timed(TMD_CUT, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_BLIND, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_CONFUSED, TRUE)) *ident = TRUE;
			return TRUE;
		}

		case EF_CURE_CRITICAL:
		{
			if (hp_player(60)) *ident = TRUE;
			if (clear_timed(TMD_BLIND, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_CONFUSED, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_POISONED, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_STUN, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_CUT, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_AMNESIA, TRUE)) *ident = TRUE;
			return TRUE;
		}

		case EF_CURE_FULL:
		{
			int amt = (p_ptr->mhp * 35) / 100;
			if (amt < 300) amt = 300;

			if (hp_player(amt)) *ident = TRUE;
			if (clear_timed(TMD_BLIND, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_CONFUSED, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_POISONED, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_STUN, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_CUT, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_AMNESIA, TRUE)) *ident = TRUE;
			return TRUE;
		}

		case EF_CURE_FULL2:
		{
			if (hp_player(1200)) *ident = TRUE;
			if (clear_timed(TMD_BLIND, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_CONFUSED, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_POISONED, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_STUN, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_CUT, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_AMNESIA, TRUE)) *ident = TRUE;
			return TRUE;
		}

		case EF_CURE_TEMP:
		{
			if (clear_timed(TMD_BLIND, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_POISONED, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_CONFUSED, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_STUN, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_CUT, TRUE)) *ident = TRUE;
			return TRUE;
		}

		case EF_HEAL1:
		{
			if (hp_player(500)) *ident = TRUE;
			if (clear_timed(TMD_CUT, TRUE)) *ident = TRUE;
			return TRUE;
		}

		case EF_HEAL2:
		{
			if (hp_player(1000)) *ident = TRUE;
			if (clear_timed(TMD_CUT, TRUE)) *ident = TRUE;
			return TRUE;
		}

		case EF_HEAL3:
		{
			if (hp_player(500)) *ident = TRUE;
			if (clear_timed(TMD_STUN, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_CUT, TRUE)) *ident = TRUE;
			return TRUE;
		}

		case EF_GAIN_EXP:
		{
			if (p_ptr->exp < PY_MAX_EXP)
			{
				msg("You feel more experienced.");
				player_exp_gain(p_ptr, 100000L);
				*ident = TRUE;
			}
			return TRUE;
		}

		case EF_LOSE_EXP:
		{
			if (!check_state(OF_HOLD_LIFE, p_ptr->state.flags) && (p_ptr->exp > 0))
			{
				msg("You feel your memories fade.");
				player_exp_lose(p_ptr, p_ptr->exp / 4, FALSE);
				*ident = TRUE;
			}
			*ident = TRUE;
			wieldeds_notice_flag(OF_HOLD_LIFE);
			return TRUE;
		}

		case EF_RESTORE_EXP:
		{
			if (restore_level()) *ident = TRUE;
			return TRUE;
		}

		case EF_RESTORE_MANA:
		{
			if (p_ptr->csp < p_ptr->msp)
			{
				p_ptr->csp = p_ptr->msp;
				p_ptr->csp_frac = 0;
				msg("Your feel your head clear.");
				p_ptr->redraw |= (PR_MANA);
				*ident = TRUE;
			}
			return TRUE;
		}

		case EF_GAIN_STR:
		case EF_GAIN_INT:
		case EF_GAIN_WIS:
		case EF_GAIN_DEX:
		case EF_GAIN_CON:
		case EF_GAIN_CHR:
		{
			int stat = effect - EF_GAIN_STR;
			if (do_inc_stat(stat)) *ident = TRUE;
			return TRUE;
		}

		case EF_GAIN_ALL:
		{
			if (do_inc_stat(A_STR)) *ident = TRUE;
			if (do_inc_stat(A_INT)) *ident = TRUE;
			if (do_inc_stat(A_WIS)) *ident = TRUE;
			if (do_inc_stat(A_DEX)) *ident = TRUE;
			if (do_inc_stat(A_CON)) *ident = TRUE;
			if (do_inc_stat(A_CHR)) *ident = TRUE;
			return TRUE;
		}

		case EF_BRAWN:
		{
			/* Pick a random stat to decrease other than strength */
			int stat = randint0(A_MAX-1) + 1;

			if (do_dec_stat(stat, TRUE))
			{
				do_inc_stat(A_STR);
				*ident = TRUE;
			}

			return TRUE;
		}

		case EF_INTELLECT:
		{
			/* Pick a random stat to decrease other than intelligence */
			int stat = randint0(A_MAX-1);
			if (stat >= A_INT) stat++;

			if (do_dec_stat(stat, TRUE))
			{
				do_inc_stat(A_INT);
				*ident = TRUE;
			}

			return TRUE;
		}

		case EF_CONTEMPLATION:
		{
			/* Pick a random stat to decrease other than wisdom */
			int stat = randint0(A_MAX-1);
			if (stat >= A_WIS) stat++;

			if (do_dec_stat(stat, TRUE))
			{
				do_inc_stat(A_WIS);
				*ident = TRUE;
			}

			return TRUE;
		}

		case EF_TOUGHNESS:
		{
			/* Pick a random stat to decrease other than constitution */
			int stat = randint0(A_MAX-1);
			if (stat >= A_CON) stat++;

			if (do_dec_stat(stat, TRUE))
			{
				do_inc_stat(A_CON);
				*ident = TRUE;
			}

			return TRUE;
		}

		case EF_NIMBLENESS:
		{
			/* Pick a random stat to decrease other than dexterity */
			int stat = randint0(A_MAX-1);
			if (stat >= A_DEX) stat++;

			if (do_dec_stat(stat, TRUE))
			{
				do_inc_stat(A_DEX);
				*ident = TRUE;
			}

			return TRUE;
		}

		case EF_PLEASING:
		{
			/* Pick a random stat to decrease other than charisma */
			int stat = randint0(A_MAX-1);

			if (do_dec_stat(stat, TRUE))
			{
				do_inc_stat(A_CHR);
				*ident = TRUE;
			}

			return TRUE;
		}

		case EF_LOSE_STR:
		case EF_LOSE_INT:
		case EF_LOSE_WIS:
		case EF_LOSE_DEX:
		case EF_LOSE_CON:
		case EF_LOSE_CHR:
		{
			int stat = effect - EF_LOSE_STR;

			take_hit(damroll(5, 5), "stat drain");
			(void)do_dec_stat(stat, FALSE);
			*ident = TRUE;

			return TRUE;
		}

		case EF_LOSE_CON2:
		{
			take_hit(damroll(10, 10), "poisonous food");
			(void)do_dec_stat(A_CON, FALSE);
			*ident = TRUE;

			return TRUE;
		}

		case EF_RESTORE_STR:
		case EF_RESTORE_INT:
		case EF_RESTORE_WIS:
		case EF_RESTORE_DEX:
		case EF_RESTORE_CON:
		case EF_RESTORE_CHR:
		{
			int stat = effect - EF_RESTORE_STR;
			if (do_res_stat(stat)) *ident = TRUE;
			return TRUE;
		}

		case EF_CURE_NONORLYBIG:
		{
			msg("You feel life flow through your body!");
			restore_level();
			(void)clear_timed(TMD_POISONED, TRUE);
			(void)clear_timed(TMD_BLIND, TRUE);
			(void)clear_timed(TMD_CONFUSED, TRUE);
			(void)clear_timed(TMD_IMAGE, TRUE);
			(void)clear_timed(TMD_STUN, TRUE);
			(void)clear_timed(TMD_CUT, TRUE);
			(void)clear_timed(TMD_AMNESIA, TRUE);

			if (do_res_stat(A_STR)) *ident = TRUE;
			if (do_res_stat(A_INT)) *ident = TRUE;
			if (do_res_stat(A_WIS)) *ident = TRUE;
			if (do_res_stat(A_DEX)) *ident = TRUE;
			if (do_res_stat(A_CON)) *ident = TRUE;
			if (do_res_stat(A_CHR)) *ident = TRUE;

			/* Recalculate max. hitpoints */
			update_stuff();

			hp_player(5000);

			*ident = TRUE;
			return TRUE;
		}

		case EF_RESTORE_ALL:
		{
			/* Life, above, also gives these effects */
			if (do_res_stat(A_STR)) *ident = TRUE;
			if (do_res_stat(A_INT)) *ident = TRUE;
			if (do_res_stat(A_WIS)) *ident = TRUE;
			if (do_res_stat(A_DEX)) *ident = TRUE;
			if (do_res_stat(A_CON)) *ident = TRUE;
			if (do_res_stat(A_CHR)) *ident = TRUE;
			return TRUE;
		}

		case EF_RESTORE_ST_LEV:
		{
			if (restore_level()) *ident = TRUE;
			if (do_res_stat(A_STR)) *ident = TRUE;
			if (do_res_stat(A_INT)) *ident = TRUE;
			if (do_res_stat(A_WIS)) *ident = TRUE;
			if (do_res_stat(A_DEX)) *ident = TRUE;
			if (do_res_stat(A_CON)) *ident = TRUE;
			if (do_res_stat(A_CHR)) *ident = TRUE;
			return TRUE;
		}

		case EF_TMD_INFRA:
		{
			if (inc_timed(TMD_SINFRA, 100 + damroll(4, 25), TRUE, TRUE))
				*ident = TRUE;
			return TRUE;
		}

		case EF_TMD_SINVIS:
		{
			if (clear_timed(TMD_BLIND, TRUE)) *ident = TRUE;
			if (inc_timed(TMD_SINVIS, 12 + damroll(2, 6), TRUE, TRUE))
				*ident = TRUE;
			return TRUE;
		}

		case EF_TMD_ESP:
		{
			if (clear_timed(TMD_BLIND, TRUE)) *ident = TRUE;
			if (inc_timed(TMD_TELEPATHY, 12 + damroll(6, 6), TRUE, TRUE))
				*ident = TRUE;
			return TRUE;
		}


		case EF_ENLIGHTENMENT:
		{
			msg("An image of your surroundings forms in your mind...");
			wiz_light();
			*ident = TRUE;
			return TRUE;
		}


		case EF_ENLIGHTENMENT2:
		{
			msg("You begin to feel more enlightened...");
			message_flush();
			wiz_light();
			(void)do_inc_stat(A_INT);
			(void)do_inc_stat(A_WIS);
			(void)detect_traps(TRUE);
			(void)detect_doorstairs(TRUE);
			(void)detect_treasure(TRUE);
			identify_pack();
			*ident = TRUE;
			return TRUE;
		}

		case EF_HERO:
		{
			dur = randint1(25) + 25;
			if (hp_player(10)) *ident = TRUE;
			if (clear_timed(TMD_AFRAID, TRUE)) *ident = TRUE;
			if (inc_timed(TMD_BOLD, dur, TRUE, TRUE)) *ident = TRUE;
			if (inc_timed(TMD_HERO, dur, TRUE, TRUE)) *ident = TRUE;
			return TRUE;
		}

		case EF_SHERO:
		{
			dur = randint1(25) + 25;
			if (hp_player(30)) *ident = TRUE;
			if (clear_timed(TMD_AFRAID, TRUE)) *ident = TRUE;
			if (inc_timed(TMD_BOLD, dur, TRUE, TRUE)) *ident = TRUE;
			if (inc_timed(TMD_SHERO, dur, TRUE, TRUE)) *ident = TRUE;
			return TRUE;
		}


		case EF_RESIST_ACID:
		{
			if (inc_timed(TMD_OPP_ACID, randint1(10) + 10, TRUE, TRUE))
				*ident = TRUE;
			return TRUE;
		}

		case EF_RESIST_ELEC:
		{
			if (inc_timed(TMD_OPP_ELEC, randint1(10) + 10, TRUE, TRUE))
				*ident = TRUE;
			return TRUE;
		}

		case EF_RESIST_FIRE:
		{
			if (inc_timed(TMD_OPP_FIRE, randint1(10) + 10, TRUE, TRUE))
				*ident = TRUE;
			return TRUE;
		}

		case EF_RESIST_COLD:
		{
			if (inc_timed(TMD_OPP_COLD, randint1(10) + 10, TRUE, TRUE))
				*ident = TRUE;
			return TRUE;
		}

		case EF_RESIST_POIS:
		{
			if (inc_timed(TMD_OPP_POIS, randint1(10) + 10, TRUE, TRUE))
				*ident = TRUE;
			return TRUE;
		}

		case EF_RESIST_ALL:
		{
			if (inc_timed(TMD_OPP_ACID, randint1(20) + 20, TRUE, TRUE))
				*ident = TRUE;
			if (inc_timed(TMD_OPP_ELEC, randint1(20) + 20, TRUE, TRUE))
				*ident = TRUE;
			if (inc_timed(TMD_OPP_FIRE, randint1(20) + 20, TRUE, TRUE))
				*ident = TRUE;
			if (inc_timed(TMD_OPP_COLD, randint1(20) + 20, TRUE, TRUE))
				*ident = TRUE;
			if (inc_timed(TMD_OPP_POIS, randint1(20) + 20, TRUE, TRUE))
				*ident = TRUE;
			return TRUE;
		}

		case EF_DETECT_TREASURE:
		{
			if (detect_treasure(aware)) *ident = TRUE;
			return TRUE;
		}

		case EF_DETECT_TRAP:
		{
			if (detect_traps(aware)) *ident = TRUE;
			return TRUE;
		}

		case EF_DETECT_DOORSTAIR:
		{
			if (detect_doorstairs(aware)) *ident = TRUE;
			return TRUE;
		}

		case EF_DETECT_INVIS:
		{
			if (detect_monsters_invis(aware)) *ident = TRUE;
			return TRUE;
		}

		case EF_DETECT_EVIL:
		{
			if (detect_monsters_evil(aware)) *ident = TRUE;
			return TRUE;
		}

		case EF_DETECT_ALL:
		{
			if (detect_all(aware)) *ident = TRUE;
			return TRUE;
		}

		case EF_ENCHANT_TOHIT:
		{
			*ident = TRUE;
			return enchant_spell(1, 0, 0);
		}

		case EF_ENCHANT_TODAM:
		{
			*ident = TRUE;
			return enchant_spell(0, 1, 0);
		}

		case EF_ENCHANT_WEAPON:
		{
			*ident = TRUE;
			return enchant_spell(randint1(3), randint1(3), 0);
		}

		case EF_ENCHANT_ARMOR:
		{
			*ident = TRUE;
			return enchant_spell(0, 0, 1);
		}

		case EF_ENCHANT_ARMOR2:
		{
			*ident = TRUE;
			return enchant_spell(0, 0, randint1(3) + 2);
		}

		case EF_RESTORE_ITEM:
		{
			*ident = TRUE;
			return restore_item();
		}

		case EF_IDENTIFY:
		{
			*ident = TRUE;
			if (!ident_spell()) return FALSE;
			return TRUE;
		}

		case EF_REMOVE_CURSE:
		{
			if (remove_curse())
			{
				if (!p_ptr->timed[TMD_BLIND])
					msg("The air around your body glows blue for a moment...");
				else
					msg("You feel as if someone is watching over you.");

				*ident = TRUE;
			}
			return TRUE;
		}

		case EF_REMOVE_CURSE2:
		{
			remove_all_curse();
			*ident = TRUE;
			return TRUE;
		}

		case EF_LIGHT:
		{
			if (light_area(damroll(2, 8), 2)) *ident = TRUE;
			return TRUE;
		}

		case EF_SUMMON_MON:
		{
			int i;
			sound(MSG_SUM_MONSTER);

			for (i = 0; i < randint1(3); i++)
			{
				if (summon_specific(py, px, p_ptr->depth, 0, 1))
					*ident = TRUE;
			}
			return TRUE;
		}

		case EF_SUMMON_UNDEAD:
		{
			int i;
			sound(MSG_SUM_UNDEAD);

			for (i = 0; i < randint1(3); i++)
			{
				if (summon_specific(py, px, p_ptr->depth,
					S_UNDEAD, 1))
					*ident = TRUE;
			}
			return TRUE;
		}

		case EF_TELE_PHASE:
		{
			teleport_player(10);
			*ident = TRUE;
			return TRUE;
		}

		case EF_TELE_LONG:
		{
			teleport_player(100);
			*ident = TRUE;
			return TRUE;
		}

		case EF_TELE_LEVEL:
		{
			(void)teleport_player_level();
			*ident = TRUE;
			return TRUE;
		}

		case EF_CONFUSING:
		{
			if (p_ptr->confusing == 0)
			{
				msg("Your hands begin to glow.");
				p_ptr->confusing = TRUE;
				*ident = TRUE;
			}
			return TRUE;
		}

		case EF_MAPPING:
		{
			map_area();
			*ident = TRUE;
			return TRUE;
		}

		case EF_RUNE:
		{
			warding_glyph();
			*ident = TRUE;
			return TRUE;
		}

		case EF_ACQUIRE:
		{
			acquirement(py, px, p_ptr->depth, 1, TRUE);
			*ident = TRUE;
			return TRUE;
		}

		case EF_ACQUIRE2:
		{
			acquirement(py, px, p_ptr->depth, randint1(2) + 1,
				TRUE);
			*ident = TRUE;
			return TRUE;
		}

		case EF_ANNOY_MON:
		{
			msg("There is a high pitched humming noise.");
			aggravate_monsters(0);
			*ident = TRUE;
			return TRUE;
		}

		case EF_CREATE_TRAP:
		{
			/* Hack -- no traps in the town */
			if (p_ptr->depth == 0)
				return TRUE;

			trap_creation();
			msg("You hear a low-pitched whistling sound.");
			*ident = TRUE;
			return TRUE;
		}

		case EF_DESTROY_TDOORS:
		{
			if (destroy_doors_touch()) *ident = TRUE;
			return TRUE;
		}

		case EF_RECHARGE:
		{
			*ident = TRUE;
			if (!recharge(60)) return FALSE;
			return TRUE;
		}

		case EF_BANISHMENT:
		{
			*ident = TRUE;
			if (!banishment()) return FALSE;
			return TRUE;
		}

		case EF_DARKNESS:
		{
			if (!check_state(OF_RES_DARK, p_ptr->state.flags))
				(void)inc_timed(TMD_BLIND, 3 + randint1(5), TRUE, TRUE);
			unlight_area(10, 3);
			wieldeds_notice_flag(OF_RES_DARK);
			*ident = TRUE;
			return TRUE;
		}

		case EF_PROTEVIL:
		{
			if (inc_timed(TMD_PROTEVIL, randint1(25) + 3 *
				p_ptr->lev, TRUE, TRUE)) *ident = TRUE;
			return TRUE;
		}

		case EF_SATISFY:
		{
			if (set_food(PY_FOOD_MAX - 1)) *ident = TRUE;
			return TRUE;
		}

		case EF_CURSE_WEAPON:
		{
			if (curse_weapon()) *ident = TRUE;
			return TRUE;
		}

		case EF_CURSE_ARMOR:
		{
			if (curse_armor()) *ident = TRUE;
			return TRUE;
		}

		case EF_BLESSING:
		{
			if (inc_timed(TMD_BLESSED, randint1(12) + 6, TRUE, TRUE))
				*ident = TRUE;
			return TRUE;
		}

		case EF_BLESSING2:
		{
			if (inc_timed(TMD_BLESSED, randint1(24) + 12, TRUE, TRUE))
				*ident = TRUE;
			return TRUE;
		}

		case EF_BLESSING3:
		{
			if (inc_timed(TMD_BLESSED, randint1(48) + 24, TRUE, TRUE))
				*ident = TRUE;
			return TRUE;
		}

		case EF_RECALL:
		{
			set_recall();
			*ident = TRUE;
			return TRUE;
		}

		case EF_DEEP_DESCENT:
		{
			int i, target_depth = p_ptr->depth;
			
			/* Calculate target depth */
			for (i = 2; i > 0; i--) {
				if (is_quest(target_depth)) break;
				if (target_depth >= MAX_DEPTH - 1) break;
				
				target_depth++;
			}

			if (target_depth > p_ptr->depth) {
				msgt(MSG_TPLEVEL, "You sink through the floor...");
				dungeon_change_level(target_depth);
				*ident = TRUE;
				return TRUE;
			} else {
				msgt(MSG_TPLEVEL, "You sense a malevolent presence blocking passage to the levels below.");
				*ident = TRUE;
				return FALSE;
			}
		}

		case EF_LOSHASTE:
		{
			if (speed_monsters()) *ident = TRUE;
			return TRUE;
		}

		case EF_LOSSLEEP:
		{
			if (sleep_monsters(aware)) *ident = TRUE;
			return TRUE;
		}

		case EF_LOSSLOW:
		{
			if (slow_monsters()) *ident = TRUE;
			return TRUE;
		}

		case EF_LOSCONF:
		{
			if (confuse_monsters(aware)) *ident = TRUE;
			return TRUE;
		}

		case EF_LOSKILL:
		{
			(void)mass_banishment();
			*ident = TRUE;
			return TRUE;
		}

		case EF_EARTHQUAKES:
		{
			earthquake(py, px, 10);
			*ident = TRUE;
			return TRUE;
		}

		case EF_DESTRUCTION2:
		{
			destroy_area(py, px, 15, TRUE);
			*ident = TRUE;
			return TRUE;
		}

		case EF_ILLUMINATION:
		{
			if (light_area(damroll(2, 15), 3)) *ident = TRUE;
			return TRUE;
		}

		case EF_CLAIRVOYANCE:
		{
			*ident = TRUE;
			wiz_light();
			(void)detect_traps(TRUE);
			(void)detect_doorstairs(TRUE);
			return TRUE;
		}

		case EF_PROBING:
		{
			*ident = probing();
			return TRUE;
		}

		case EF_STONE_TO_MUD:
		{
			if (wall_to_mud(dir)) *ident = TRUE;
			return TRUE;
		}

		case EF_CONFUSE2:
		{
			*ident = TRUE;
			confuse_monster(dir, 20, aware);
			return TRUE;
		}

		case EF_BIZARRE:
		{
			*ident = TRUE;
			ring_of_power(dir);
			return TRUE;
		}

		case EF_STAR_BALL:
		{
			int i;
			*ident = TRUE;
			for (i = 0; i < 8; i++) fire_ball(GF_ELEC, ddd[i],
				(150 * (100 + boost) / 100), 3);
			return TRUE;
		}

		case EF_RAGE_BLESS_RESIST:
		{
			dur = randint1(50) + 50;
			*ident = TRUE;
			(void)hp_player(30);
			(void)clear_timed(TMD_AFRAID, TRUE);
			(void)inc_timed(TMD_BOLD, dur, TRUE, TRUE);
			(void)inc_timed(TMD_SHERO, dur, TRUE, TRUE);
			(void)inc_timed(TMD_BLESSED, randint1(50) + 50, TRUE, TRUE);
			(void)inc_timed(TMD_OPP_ACID, randint1(50) + 50, TRUE, TRUE);
			(void)inc_timed(TMD_OPP_ELEC, randint1(50) + 50, TRUE, TRUE);
			(void)inc_timed(TMD_OPP_FIRE, randint1(50) + 50, TRUE, TRUE);
			(void)inc_timed(TMD_OPP_COLD, randint1(50) + 50, TRUE, TRUE);
			(void)inc_timed(TMD_OPP_POIS, randint1(50) + 50, TRUE, TRUE);
			return TRUE;
		}

		case EF_SLEEPII:
		{
			*ident = TRUE;
			sleep_monsters_touch(aware);
			return TRUE;
		}

		case EF_RESTORE_LIFE:
		{
			*ident = TRUE;
			restore_level();
			return TRUE;
		}

		case EF_MISSILE:
		{
			*ident = TRUE;
			dam = damroll(3, 4) * (100 + boost) / 100;
			fire_bolt_or_beam(beam, GF_MISSILE, dir, dam);
			return TRUE;
		}

		case EF_DISPEL_EVIL:
		{
			*ident = TRUE;
			dam = p_ptr->lev * 5 * (100 + boost) / 100;
			dispel_evil(dam);
			return TRUE;
		}

		case EF_DISPEL_EVIL60:
		{
			dam = 60 * (100 + boost) / 100;
			if (dispel_evil(dam)) *ident = TRUE;
			return TRUE;
		}

		case EF_DISPEL_UNDEAD:
		{
			dam = 60 * (100 + boost) / 100;
			if (dispel_undead(dam)) *ident = TRUE;
			return TRUE;
		}

		case EF_DISPEL_ALL:
		{
			dam = 120 * (100 + boost) / 100;
			if (dispel_monsters(dam)) *ident = TRUE;
			return TRUE;
		}

		case EF_HASTE:
		{
			if (!p_ptr->timed[TMD_FAST])
			{
				if (set_timed(TMD_FAST, damroll(2, 10) + 20, TRUE)) *ident = TRUE;
			}
			else
			{
				(void)inc_timed(TMD_FAST, 5, TRUE, TRUE);
			}

			return TRUE;
		}

		case EF_HASTE1:
		{
			if (!p_ptr->timed[TMD_FAST])
			{
				if (set_timed(TMD_FAST, randint1(20) + 20, TRUE)) *ident = TRUE;
			}
			else
			{
				(void)inc_timed(TMD_FAST, 5, TRUE, TRUE);
			}

			return TRUE;
		}

		case EF_HASTE2:
		{
			if (!p_ptr->timed[TMD_FAST])
			{
				if (set_timed(TMD_FAST, randint1(75) + 75, TRUE)) *ident = TRUE;
			}
			else
			{
				(void)inc_timed(TMD_FAST, 5, TRUE, TRUE);
			}

			return TRUE;
		}


		case EF_FIRE_BOLT:
		{
			*ident = TRUE;
			dam = damroll(9, 8) * (100 + boost) / 100;
			fire_bolt(GF_FIRE, dir, dam);
			return TRUE;
		}

		case EF_FIRE_BOLT2:
		{
			dam = damroll(12, 8) * (100 + boost) / 100;
			fire_bolt_or_beam(beam, GF_FIRE, dir, dam);
			*ident = TRUE;
			return TRUE;
		}

		case EF_FIRE_BOLT3:
		{
			dam = damroll(16, 8) * (100 + boost) / 100;
			fire_bolt_or_beam(beam, GF_FIRE, dir, dam);
			*ident = TRUE;
			return TRUE;
		}

		case EF_FIRE_BOLT72:
		{
			dam = 72 * (100 + boost) / 100;
			*ident = TRUE;
			fire_ball(GF_FIRE, dir, dam, 2);
			return TRUE;
		}

		case EF_FIRE_BALL:
		{
			dam = 144 * (100 + boost) / 100;
			fire_ball(GF_FIRE, dir, dam, 2);
			*ident = TRUE;
			return TRUE;
		}

		case EF_FIRE_BALL2:
		{
			dam = 120 * (100 + boost) / 100;
			*ident = TRUE;
			fire_ball(GF_FIRE, dir, dam, 3);
			return TRUE;
		}

		case EF_FIRE_BALL200:
		{
			dam = 200 * (100 + boost) / 100;
			*ident = TRUE;
			fire_ball(GF_FIRE, dir, dam, 3);
			return TRUE;
		}

		case EF_COLD_BOLT:
		{
			dam = damroll(6, 8) * (100 + boost) / 100;
			*ident = TRUE;
			fire_bolt_or_beam(beam, GF_COLD, dir, dam);
			return TRUE;
		}

		case EF_COLD_BOLT2:
		{
			dam = damroll(12, 8) * (100 + boost) / 100;
			*ident = TRUE;
			fire_bolt(GF_COLD, dir, dam);
			return TRUE;
		}

		case EF_COLD_BALL2:
		{
			dam = 200 * (100 + boost) / 100;
			*ident = TRUE;
			fire_ball(GF_COLD, dir, dam, 3);
			return TRUE;
		}

		case EF_COLD_BALL50:
		{
			dam = 50 * (100 + boost) / 100;
			*ident = TRUE;
			fire_ball(GF_COLD, dir, dam, 2);
			return TRUE;
		}

		case EF_COLD_BALL100:
		{
			dam = 100 * (100 + boost) / 100;
			*ident = TRUE;
			fire_ball(GF_COLD, dir, dam, 2);
			return TRUE;
		}

		case EF_COLD_BALL160:
		{
			dam = 160 * (100 + boost) / 100;
			*ident = TRUE;
			fire_ball(GF_COLD, dir, dam, 3);
			return TRUE;
		}

		case EF_ACID_BOLT:
		{
			dam = damroll(5, 8) * (100 + boost) / 100;
			*ident = TRUE;
			fire_bolt(GF_ACID, dir, dam);
			return TRUE;
		}

		case EF_ACID_BOLT2:
		{
			dam = damroll(10, 8) * (100 + boost) / 100;
			fire_bolt_or_beam(beam, GF_ACID, dir, dam);
			*ident = TRUE;
			return TRUE;
		}

		case EF_ACID_BOLT3:
		{
			dam = damroll(12, 8) * (100 + boost) / 100;
			fire_bolt_or_beam(beam, GF_ACID, dir, dam);
			*ident = TRUE;
			return TRUE;
		}

		case EF_ACID_BALL:
		{
			dam = 120 * (100 + boost) / 100;
			fire_ball(GF_ACID, dir, dam, 2);
			*ident = TRUE;
			return TRUE;
		}

		case EF_ELEC_BOLT:
		{
			dam = damroll(6, 6) * (100 + boost) / 100;
			*ident = TRUE;
			fire_beam(GF_ELEC, dir, dam);
			return TRUE;
		}

		case EF_ELEC_BALL:
		{
			dam = 64 * (100 + boost) / 100;
			fire_ball(GF_ELEC, dir, dam, 2);
			*ident = TRUE;
			return TRUE;
		}

		case EF_ELEC_BALL2:
		{
			dam = 250 * (100 + boost) / 100;
			*ident = TRUE;
			fire_ball(GF_ELEC, dir, dam, 3);
			return TRUE;
		}


		case EF_ARROW:
		{
			dam = 150 * (100 + boost) / 100;
			*ident = TRUE;
			fire_bolt(GF_ARROW, dir, dam);
			return TRUE;
		}

		case EF_REM_FEAR_POIS:
		{
			*ident = TRUE;
			(void)clear_timed(TMD_AFRAID, TRUE);
			(void)clear_timed(TMD_POISONED, TRUE);
			return TRUE;
		}

		case EF_STINKING_CLOUD:
		{
			dam = 12 * (100 + boost) / 100;
			*ident = TRUE;
			fire_ball(GF_POIS, dir, dam, 3);
			return TRUE;
		}


		case EF_DRAIN_LIFE1:
		{
			dam = 90 * (100 + boost) / 100;
			if (drain_life(dir, dam)) *ident = TRUE;
			return TRUE;
		}

		case EF_DRAIN_LIFE2:
		{
			dam = 120 * (100 + boost) / 100;
			if (drain_life(dir, dam)) *ident = TRUE;
			return TRUE;
		}

		case EF_DRAIN_LIFE3:
		{
			dam = 150 * (100 + boost) / 100;
			if (drain_life(dir, dam)) *ident = TRUE;
			return TRUE;
		}

		case EF_DRAIN_LIFE4:
		{
			dam = 250 * (100 + boost) / 100;
			if (drain_life(dir, dam)) *ident = TRUE;
			return TRUE;
		}

		case EF_FIREBRAND:
		{
			*ident = TRUE;
			if (!brand_bolts()) return FALSE;
			return TRUE;
		}

		case EF_MANA_BOLT:
		{
			dam = damroll(12, 8) * (100 + boost) / 100;
			fire_bolt(GF_MANA, dir, dam);
			*ident = TRUE;
			return TRUE;
		}

		case EF_MON_HEAL:
		{
			if (heal_monster(dir)) *ident = TRUE;
			return TRUE;
		}

		case EF_MON_HASTE:
		{
			if (speed_monster(dir)) *ident = TRUE;
			return TRUE;
		}

		case EF_MON_SLOW:
		{
			if (slow_monster(dir)) *ident = TRUE;
			return TRUE;
		}

		case EF_MON_CONFUSE:
		{
			if (confuse_monster(dir, 10, aware)) *ident = TRUE;
			return TRUE;
		}

		case EF_MON_SLEEP:
		{
			if (sleep_monster(dir, aware)) *ident = TRUE;
			return TRUE;
		}

		case EF_MON_CLONE:
		{
			if (clone_monster(dir)) *ident = TRUE;
			return TRUE;
		}

		case EF_MON_SCARE:
		{
			if (fear_monster(dir, 10, aware)) *ident = TRUE;
			return TRUE;
		}

		case EF_LIGHT_LINE:
		{
			msg("A line of shimmering blue light appears.");
			light_line(dir);
			*ident = TRUE;
			return TRUE;
		}

		case EF_TELE_OTHER:
		{
			if (teleport_monster(dir)) *ident = TRUE;
			return TRUE;
		}

		case EF_DISARMING:
		{
			if (disarm_trap(dir)) *ident = TRUE;
			return TRUE;
		}

		case EF_TDOOR_DEST:
		{
			if (destroy_door(dir)) *ident = TRUE;
			return TRUE;
		}

		case EF_POLYMORPH:
		{
			if (poly_monster(dir)) *ident = TRUE;
			return TRUE;
		}

		case EF_STARLIGHT:
		{
			int i;
			if (!p_ptr->timed[TMD_BLIND])
				msg("Light shoots in all directions!");
			for (i = 0; i < 8; i++) light_line(ddd[i]);
			*ident = TRUE;
			return TRUE;
		}

		case EF_STARLIGHT2:
		{
			int k;
			for (k = 0; k < 8; k++) strong_light_line(ddd[k]);
			*ident = TRUE;
			return TRUE;
		}

		case EF_BERSERKER:
		{
			dur = randint1(50) + 50;
			if (inc_timed(TMD_BOLD, dur, TRUE, TRUE)) *ident = TRUE;
			if (inc_timed(TMD_SHERO, dur, TRUE, TRUE)) *ident = TRUE;
			return TRUE;
		}

		case EF_WONDER:
		{
			if (effect_wonder(dir, randint1(100) + p_ptr->lev / 5,
				beam)) *ident = TRUE;
			return TRUE;
		}

		case EF_WAND_BREATH:
		{
			/* table of random ball effects and their damages */
			const int breath_types[] = {
				GF_ACID, 200,
				GF_ELEC, 160,
				GF_FIRE, 200,
				GF_COLD, 160,
				GF_POIS, 120
			};
			/* pick a random (type, damage) tuple in the table */
			int which = 2 * randint0(sizeof(breath_types) / (2 * sizeof(int)));
			fire_ball(breath_types[which], dir, breath_types[which + 1], 3);
			*ident = TRUE;
			return TRUE;
		}

		case EF_STAFF_MAGI:
		{
			if (do_res_stat(A_INT)) *ident = TRUE;
			if (p_ptr->csp < p_ptr->msp)
			{
				p_ptr->csp = p_ptr->msp;
				p_ptr->csp_frac = 0;
				*ident = TRUE;
				msg("Your feel your head clear.");
				p_ptr->redraw |= (PR_MANA);
			}
			return TRUE;
		}

		case EF_STAFF_HOLY:
		{
			dam = 120 * (100 + boost) / 100;
			if (dispel_evil(dam)) *ident = TRUE;
			if (inc_timed(TMD_PROTEVIL, randint1(25) + 3 *
				p_ptr->lev, TRUE, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_POISONED, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_AFRAID, TRUE)) *ident = TRUE;
			if (hp_player(50)) *ident = TRUE;
			if (clear_timed(TMD_STUN, TRUE)) *ident = TRUE;
			if (clear_timed(TMD_CUT, TRUE)) *ident = TRUE;
			return TRUE;
		}

		case EF_DRINK_BREATH:
		{
			const int breath_types[] =
			{
				GF_FIRE, 80,
				GF_COLD, 80,
			};

			int which = 2 * randint0(N_ELEMENTS(breath_types) / 2);
			fire_ball(breath_types[which], dir, breath_types[which + 1], 2);
			*ident = TRUE;
			return TRUE;
		}

		case EF_DRINK_GOOD:
		{
			msg("You feel less thirsty.");
			*ident = TRUE;
			return TRUE;
		}

		case EF_DRINK_DEATH:
		{
			msg("A feeling of Death flows through your body.");
			take_hit(5000, "a potion of Death");
			*ident = TRUE;
			return TRUE;
		}

		case EF_DRINK_RUIN:
		{
			msg("Your nerves and muscles feel weak and lifeless!");
			take_hit(damroll(10, 10), "a potion of Ruination");
			player_stat_dec(p_ptr, A_DEX, TRUE);
			player_stat_dec(p_ptr, A_WIS, TRUE);
			player_stat_dec(p_ptr, A_CON, TRUE);
			player_stat_dec(p_ptr, A_STR, TRUE);
			player_stat_dec(p_ptr, A_CHR, TRUE);
			player_stat_dec(p_ptr, A_INT, TRUE);
			*ident = TRUE;
			return TRUE;
		}

		case EF_DRINK_DETONATE:
		{
			msg("Massive explosions rupture your body!");
			take_hit(damroll(50, 20), "a potion of Detonation");
			(void)inc_timed(TMD_STUN, 75, TRUE, TRUE);
			(void)inc_timed(TMD_CUT, 5000, TRUE, TRUE);
			*ident = TRUE;
			return TRUE;
		}

		case EF_DRINK_SALT:
		{
			msg("The potion makes you vomit!");
			(void)set_food(PY_FOOD_STARVE - 1);
			(void)clear_timed(TMD_POISONED, TRUE);
			(void)inc_timed(TMD_PARALYZED, 4, TRUE, FALSE);
			*ident = TRUE;
			return TRUE;
		}

		case EF_FOOD_GOOD:
		{
			msg("That tastes good.");
			*ident = TRUE;
			return TRUE;
		}

		case EF_FOOD_WAYBREAD:
		{
			msg("That tastes good.");
			(void)clear_timed(TMD_POISONED, TRUE);
			(void)hp_player(damroll(4, 8));
			*ident = TRUE;
			return TRUE;
		}

		case EF_SHROOM_EMERGENCY:
		{
			(void)set_timed(TMD_IMAGE, rand_spread(250, 50), TRUE);
			(void)set_timed(TMD_OPP_FIRE, rand_spread(30, 10), TRUE);
			(void)set_timed(TMD_OPP_COLD, rand_spread(30, 10), TRUE);
			(void)hp_player(200);
			*ident = TRUE;
			return TRUE;
		}

		case EF_SHROOM_TERROR:
		{
			if (set_timed(TMD_TERROR, rand_spread(100, 20), TRUE))
				*ident = TRUE;
			return TRUE;
		}

		case EF_SHROOM_STONE:
		{
			if (set_timed(TMD_STONESKIN, rand_spread(80, 20), TRUE))
				*ident = TRUE;
			return TRUE;
		}

		case EF_SHROOM_DEBILITY:
		{
			int stat = one_in_(2) ? A_STR : A_CON;

			if (p_ptr->csp < p_ptr->msp)
			{
				p_ptr->csp = p_ptr->msp;
				p_ptr->csp_frac = 0;
				msg("Your feel your head clear.");
				p_ptr->redraw |= (PR_MANA);
				*ident = TRUE;
			}

			(void)do_dec_stat(stat, FALSE);

			*ident = TRUE;
			return TRUE;
		}

		case EF_SHROOM_SPRINTING:
		{
			if (inc_timed(TMD_SPRINT, 100, TRUE, TRUE)) *ident = TRUE;
			return TRUE;
		}

		case EF_SHROOM_PURGING:
		{
			(void)set_food(PY_FOOD_FAINT - 1);
			if (do_res_stat(A_STR)) *ident = TRUE;
			if (do_res_stat(A_CON)) *ident = TRUE;
			if (clear_timed(TMD_POISONED, TRUE)) *ident = TRUE;
			return TRUE;
		}

		case EF_RING_ACID:
		{
			dam = 70 * (100 + boost) / 100;
			*ident = TRUE;
			fire_ball(GF_ACID, dir, dam, 2);
			inc_timed(TMD_OPP_ACID, randint1(20) + 20, TRUE, TRUE);
			return TRUE;
		}

		case EF_RING_FLAMES:
		{
			dam = 80 * (100 + boost) / 100;
			*ident = TRUE;
			fire_ball(GF_FIRE, dir, dam, 2);
			inc_timed(TMD_OPP_FIRE, randint1(20) + 20, TRUE, TRUE);
			return TRUE;
		}

		case EF_RING_ICE:
		{
			dam = 75 * (100 + boost) / 100;
			*ident = TRUE;
			fire_ball(GF_COLD, dir, dam, 2);
			inc_timed(TMD_OPP_COLD, randint1(20) + 20, TRUE, TRUE);
			return TRUE;
		}

		case EF_RING_LIGHTNING:
		{
			dam = 85 * (100 + boost) / 100;
			*ident = TRUE;
			fire_ball(GF_ELEC, dir, dam, 2);
			inc_timed(TMD_OPP_ELEC, randint1(20) + 20, TRUE, TRUE);
			return TRUE;
		}

		case EF_DRAGON_BLUE:
		{
			dam = 100 * (100 + boost) / 100;
			msgt(MSG_BR_ELEC, "You breathe lightning.");
			fire_ball(GF_ELEC, dir, dam, 2);
			return TRUE;
		}

		case EF_DRAGON_GREEN:
		{
			dam = 150 * (100 + boost) / 100;
			msgt(MSG_BR_GAS, "You breathe poison gas.");
			fire_ball(GF_POIS, dir, dam, 2);
			return TRUE;
		}

		case EF_DRAGON_RED:
		{
			dam = 200 * (100 + boost) / 100;
			msgt(MSG_BR_FIRE, "You breathe fire.");
			fire_ball(GF_FIRE, dir, dam, 2);
			return TRUE;
		}

		case EF_DRAGON_MULTIHUED:
		{
			static const struct
			{
				int msg_sound;
				const char *msg;
				int typ;
			} mh[] =
			{
				{ MSG_BR_ELEC,  "lightning",  GF_ELEC },
				{ MSG_BR_FROST, "frost",      GF_COLD },
				{ MSG_BR_ACID,  "acid",       GF_ACID },
				{ MSG_BR_GAS,   "poison gas", GF_POIS },
				{ MSG_BR_FIRE,  "fire",       GF_FIRE }
			};

			int chance = randint0(5);
			dam = 250 * (100 + boost) / 100;
			msgt(mh[chance].msg_sound, "You breathe %s.", mh[chance].msg);
			fire_ball(mh[chance].typ, dir, dam, 2);
			return TRUE;
		}

		case EF_DRAGON_BRONZE:
		{
			dam = 120 * (100 + boost) / 100;
			msgt(MSG_BR_CONF, "You breathe confusion.");
			fire_ball(GF_CONFU, dir, dam, 2);
			return TRUE;
		}

		case EF_DRAGON_GOLD:
		{
			dam = 130 * (100 + boost) / 100;
			msgt(MSG_BR_SOUND, "You breathe sound.");
			fire_ball(GF_SOUND, dir, dam, 2);
			return TRUE;
		}

		case EF_DRAGON_CHAOS:
		{
			dam = 220 * (100 + boost) / 100;
			chance = randint0(2);
			msgt((chance == 1 ? MSG_BR_CHAOS : MSG_BR_DISEN),
					"You breathe %s.",
					((chance == 1 ? "chaos" : "disenchantment")));
			fire_ball((chance == 1 ? GF_CHAOS : GF_DISEN),
			          dir, dam, 2);
			return TRUE;
		}

		case EF_DRAGON_LAW:
		{
			dam = 230 * (100 + boost) / 100;
			chance = randint0(2);
			msgt((chance == 1 ? MSG_BR_SOUND : MSG_BR_SHARDS), "You breathe %s.",
			           ((chance == 1 ? "sound" : "shards")));
			fire_ball((chance == 1 ? GF_SOUND : GF_SHARD),
			          dir, dam, 2);
			return TRUE;
		}

		case EF_DRAGON_BALANCE:
		{
			dam = 250 * (100 + boost) / 100;
			chance = randint0(4);
			msg("You breathe %s.",
			           ((chance == 1) ? "chaos" :
			            ((chance == 2) ? "disenchantment" :
			             ((chance == 3) ? "sound" : "shards"))));
			fire_ball(((chance == 1) ? GF_CHAOS :
			           ((chance == 2) ? GF_DISEN :
			            ((chance == 3) ? GF_SOUND : GF_SHARD))),
			          dir, dam, 2);
			return TRUE;
		}

		case EF_DRAGON_SHINING:
		{
			dam = 200 * (100 + boost) / 100;
			chance = randint0(2);
			msgt((chance == 0 ? MSG_BR_LIGHT : MSG_BR_DARK), "You breathe %s.",
			        ((chance == 0 ? "light" : "darkness")));
			fire_ball((chance == 0 ? GF_LIGHT : GF_DARK), dir, dam,
				2);
			return TRUE;
		}

		case EF_DRAGON_POWER:
		{
			dam = 300 * (100 + boost) / 100;
			msgt(MSG_BR_ELEMENTS, "You breathe the elements.");
			fire_ball(GF_MISSILE, dir, dam, 2);
			return TRUE;
		}

		case EF_TRAP_DOOR:
		{
			msg("You fall through a trap door!");
			if (check_state(OF_FEATHER, p_ptr->state.flags)) {
				msg("You float gently down to the next level.");
			} else {
				take_hit(damroll(2, 8), "a trap");
			}
			wieldeds_notice_flag(OF_FEATHER);

			dungeon_change_level(p_ptr->depth + 1);
			return TRUE;
		}

		case EF_TRAP_PIT:
		{
			msg("You fall into a pit!");
			if (check_state(OF_FEATHER, p_ptr->state.flags)) {
				msg("You float gently to the bottom of the pit.");
			} else {
				take_hit(damroll(2, 6), "a trap");
			}
			wieldeds_notice_flag(OF_FEATHER);
			return TRUE;
		}

		case EF_TRAP_PIT_SPIKES:
		{
			msg("You fall into a spiked pit!");

			if (check_state(OF_FEATHER, p_ptr->state.flags)) {
				msg("You float gently to the floor of the pit.");
				msg("You carefully avoid touching the spikes.");
			} else {
				int dam = damroll(2, 6);

				/* Extra spike damage */
				if (one_in_(2)) {
					msg("You are impaled!");
					dam *= 2;
					(void)inc_timed(TMD_CUT, randint1(dam), TRUE, TRUE);
				}

				take_hit(dam, "a trap");
			}
			wieldeds_notice_flag(OF_FEATHER);
			return TRUE;
		}

		case EF_TRAP_PIT_POISON:
		{
			msg("You fall into a spiked pit!");

			if (check_state(OF_FEATHER, p_ptr->state.flags)) {
				msg("You float gently to the floor of the pit.");
				msg("You carefully avoid touching the spikes.");
			} else {
				int dam = damroll(2, 6);

				/* Extra spike damage */
				if (one_in_(2)) {
					msg("You are impaled on poisonous spikes!");
					(void)inc_timed(TMD_CUT, randint1(dam * 2), TRUE, TRUE);
					(void)inc_timed(TMD_POISONED, randint1(dam * 4), TRUE, TRUE);
				}

				take_hit(dam, "a trap");
			}
			wieldeds_notice_flag(OF_FEATHER);
			return TRUE;
		}

		case EF_TRAP_RUNE_SUMMON:
		{
			int i;
			int num = 2 + randint1(3);

			msgt(MSG_SUM_MONSTER, "You are enveloped in a cloud of smoke!");

			/* Remove trap */
			cave->info[py][px] &= ~(CAVE_MARK);
			cave_set_feat(cave, py, px, FEAT_FLOOR);

			for (i = 0; i < num; i++)
				(void)summon_specific(py, px, p_ptr->depth, 0, 1);

			break;
		}

		case EF_TRAP_RUNE_TELEPORT:
		{
			msg("You hit a teleport trap!");
			teleport_player(100);
			return TRUE;		
		}

		case EF_TRAP_SPOT_FIRE:
		{
			int dam;

			msg("You are enveloped in flames!");
			dam = damroll(4, 6);
			dam = adjust_dam(GF_FIRE, dam, RANDOMISE,
					check_for_resist(GF_FIRE, p_ptr->state.flags, TRUE));
			if (dam) {
				take_hit(dam, "a fire trap");
				inven_damage(GF_FIRE, MIN(dam * 5, 300));
			}
			return TRUE;
		}

		case EF_TRAP_SPOT_ACID:
		{
			int dam;

			msg("You are splashed with acid!");
			dam = damroll(4, 6);
			dam = adjust_dam(GF_ACID, dam, RANDOMISE,
					check_for_resist(GF_ACID, p_ptr->state.flags, TRUE));
			if (dam) {
				take_hit(dam, "an acid trap");
				inven_damage(GF_ACID, MIN(dam * 5, 300));
			}
			return TRUE;
		}

		case EF_TRAP_DART_SLOW:
		{
			if (trap_check_hit(125)) {
				msg("A small dart hits you!");
				take_hit(damroll(1, 4), "a trap");
				(void)inc_timed(TMD_SLOW, randint0(20) + 20, TRUE, FALSE);
			} else {
				msg("A small dart barely misses you.");
			}
			return TRUE;
		}

		case EF_TRAP_DART_LOSE_STR:
		{
			if (trap_check_hit(125)) {
				msg("A small dart hits you!");
				take_hit(damroll(1, 4), "a trap");
				(void)do_dec_stat(A_STR, FALSE);
			} else {
				msg("A small dart barely misses you.");
			}
			return TRUE;
		}

		case EF_TRAP_DART_LOSE_DEX:
		{
			if (trap_check_hit(125)) {
				msg("A small dart hits you!");
				take_hit(damroll(1, 4), "a trap");
				(void)do_dec_stat(A_DEX, FALSE);
			} else {
				msg("A small dart barely misses you.");
			}
			return TRUE;
		}

		case EF_TRAP_DART_LOSE_CON:
		{
			if (trap_check_hit(125)) {
				msg("A small dart hits you!");
				take_hit(damroll(1, 4), "a trap");
				(void)do_dec_stat(A_CON, FALSE);
			} else {
				msg("A small dart barely misses you.");
			}
			return TRUE;
		}

		case EF_TRAP_GAS_BLIND:
		{
			msg("You are surrounded by a black gas!");
			(void)inc_timed(TMD_BLIND, randint0(50) + 25, TRUE, TRUE);
			return TRUE;
		}

		case EF_TRAP_GAS_CONFUSE:
		{
			msg("You are surrounded by a gas of scintillating colors!");
			(void)inc_timed(TMD_CONFUSED, randint0(20) + 10, TRUE, TRUE);
			return TRUE;
		}

		case EF_TRAP_GAS_POISON:
		{
			msg("You are surrounded by a pungent green gas!");
			(void)inc_timed(TMD_POISONED, randint0(20) + 10, TRUE, TRUE);
			return TRUE;
		}

		case EF_TRAP_GAS_SLEEP:
		{
			msg("You are surrounded by a strange white mist!");
			(void)inc_timed(TMD_PARALYZED, randint0(10) + 5, TRUE, TRUE);
			return TRUE;
		}


		case EF_XXX:
		case EF_MAX:
			break;
	}

	/* Not used */
	msg("Effect not handled.");
	return FALSE;
}
Example #19
0
/*
 * do_cmd_mind calls this function if the player's class
 * is 'Officer'.
 */
static bool cast_officer_spell(int spell)
{
	/* this will vary based on the spells, and what they depend on */
	int             plev = p_ptr->lev;
	int				dir;
	int 			time = randint(20) + 20;
	
	/* spell code */
	switch (spell)
	{
    			case 0:  if (!get_aim_dir(&dir)) return FALSE;
							(void)fear_monster(dir, plev);
						 break;
				case 1:  if (!get_aim_dir(&dir)) return FALSE;
							(void)fire_bolt(GF_STUN, dir,
							damroll(plev, 5));
						 break;
				case 2:  if (!get_aim_dir(&dir)) return FALSE; 
						 	(void)fire_bolt(GF_CHARM, dir,
						 	damroll(plev, plev));
						 break;
				case 3:  (void)hp_player(damroll((plev / 2), (plev * 2)));
						 (void)set_afraid(0);
						 (void)set_stun(0);
						 (void)set_cut(0);
						 (void)do_res_stat(A_STR);
				 		 (void)do_res_stat(A_INT);
				 		 (void)do_res_stat(A_WIS);
				 		 (void)do_res_stat(A_DEX);
				 		 (void)do_res_stat(A_CON);
				 		 (void)do_res_stat(A_CHR);
						 break;
				case 4:  (void)detect_monsters_normal();
						 break;
				case 5:  (void)set_protevil(p_ptr->protevil + randint(25) + 3 * p_ptr->lev);
						 if (!p_ptr->fast)
						{
							(void)set_fast(randint(20) + plev);
						}
						else
						{
							(void)set_fast(p_ptr->fast + randint(5));
						}
						(void)set_oppose_acid(p_ptr->oppose_acid + time);
						(void)set_oppose_elec(p_ptr->oppose_elec + time);
						(void)set_oppose_fire(p_ptr->oppose_fire + time);
						(void)set_oppose_cold(p_ptr->oppose_cold + time);
						(void)set_oppose_pois(p_ptr->oppose_pois + time);
						(void)set_invuln(p_ptr->invuln + ((plev / 20) + randint(2)));
						break;
				case 6:  if (!get_aim_dir(&dir)) return FALSE;
							fire_ball(GF_CHARM, dir,
				        				  (plev * 4), (plev / 8));
						 break;
				case 7:  break;
				case 8:  break;
				case 9:  break;
				case 10: break;
				case 11: break;
				case 12: break;
				case 13: break;
				case 14: break;
				case 15: break;
				case 16: break;
			    case 17: break;
			    case 18: break;
			    case 19: break;
			    case 20: break;
	}

	return TRUE;
}
Example #20
0
/*
 * do_cmd_mind calls this function if the player's class
 * is 'Reckoner'.
 */
static bool cast_reckoner_spell(int spell)
{
	/* this will vary based on the spells, and what they depend on */
	int     plev = p_ptr->lev;
	int 	b;
	int		py = p_ptr->py;
	int		px = p_ptr->px;
	int 	dir;
	
	/* spell code */
	switch (spell)
	{
    			case 0:	
    					if (plev < 30) 
    					{
    					teleport_player(plev);
    					}  
    					else
    					{
    					teleport_player(plev * 3);
    					}
    					break;
    					
				case 1: 
						b = (randint(50) + plev);
						if (b < 10)
						{
						unlite_area(randint(plev *2), (randint(plev / 5) + 2));
						}
						else if (b < 25)
						{
						unlite_room(py, px);
						}
						else if  (b < 50)
						{
						lite_room(py, px);
						}
						else 
						{
						lite_area(randint(plev * 2), (randint(plev / 5) + 3));
						}
						
						break;
				
				case 2: b = (randint(50) + plev);
						if (b < 20)
						{
						speed_monsters();
						}
						else if (b < 30)
						{
						slow_monsters();
						}
						else if (b < 55)
						{
						sleep_monsters();
						}
						else if (b < 75)
						{
							if (!p_ptr->fast)
							{
								(void)set_fast(randint(plev) + plev);
							}
							else
							{
								(void)set_fast(p_ptr->fast + randint(5));
							}
							break;
						}
						else
						{
						(void)set_fast(p_ptr->fast + b);
						slow_monsters();
						sleep_monsters();
						}
						 break;
				case 3:  if (!get_aim_dir(&dir)) return FALSE; 
						 (void)fire_bolt(GF_NETHER, dir,
								damroll((plev / 2), (3 + plev / 3)));
						 break;
				
				case 4:  if (!get_aim_dir(&dir)) return FALSE;
						 (void)wall_to_mud(dir);
						 break;
						 
				case 5:  (void)hp_player(damroll((plev / 3), plev));
						 (void)set_cut(0);
						 break;
						 
				case 6:  set_recall(); break;
				
				case 7:  if (!get_aim_dir(&dir)) return FALSE;
						 (void)poly_monster(dir);
						 break;
				case 8:  if (plev < 40)
						 {
						 map_area();
						 (void)set_tim_esp(p_ptr->tim_esp + 10);
						 }
						 else
						 {
						 wiz_lite();
						 (void)set_tim_esp(p_ptr->tim_esp + plev);
						 }
						 break;
				case 9:  msg_print("The world changes!");
			
 						 /* Leaving */
						 p_ptr->leaving = TRUE;
						 			
						 break;
				case 10: break;
				case 11: break;
				case 12: break;
				case 13: break;
				case 14: break;
			    case 15: break;
			    case 16: break;
			    case 17: break;
			    case 18: break;
			    case 19: break;
			    case 20: break;
	}

	return TRUE;
}
Example #21
0
/*
 * do_cmd_mind calls this function if the player's class
 * is 'Medium'.
 */
static bool cast_medium_spell(int spell)
{
	/* this will vary based on the spells, and what they depend on */
	int             b = 0;
	int 			dir;
	int             plev = p_ptr->lev;

	/* spell code */
	switch (spell)
	{
		case 0:
			/* Mindblast */
			if (!get_aim_dir(&dir)) return FALSE;

			if (randint(100) < plev * 2)
				(void)fire_bolt_or_beam(100, GF_PSI, dir,
								damroll(3 + ((plev - 1) / 4), (3 + plev / 15)));
			else
				(void)fire_ball(GF_PSI, dir,
								damroll(3 + ((plev - 1) / 4), (3 + plev / 15)),
								0);
			break;
		case 1:
			if (plev > 44)
				wiz_lite();
			else if (plev > 19)
				map_area();

			if (plev < 30)
			{
				b = detect_monsters_normal();
				if (plev > 14)
					b |= detect_monsters_invis();

				if (plev > 4)
				{
					b |= detect_traps();
					b |= detect_doors();
				}
			}
			else
			{
				b = detect_all();
			}

			if (plev > 24)
			{
				(void)set_tim_esp(p_ptr->tim_esp + plev);
			}

			if (!b) msg_print("You feel safe.");
			break;
		case 2:
			/* Minor displace */
			teleport_player(plev);
			break;
		case 3:
			/* Major displace */
			teleport_player(plev * 5);
			break;
		case 4:
			/* Psychic Disturbance */
			msg_print("You disturb specters from beyond the veil!");
			(void)project(-1, 2 + plev / 8, p_ptr->py, p_ptr->px,
						  damroll((plev / 2), plev), GF_CONFUSION, PROJECT_KILL);
			break;
		case 5:
			/* spirit blast  ---  not 'true' TK */
			if (!get_aim_dir(&dir)) return FALSE;
			(void)fire_ball(GF_SOUND, dir, damroll(8 + ((plev - 5) / 4), 8),
							(plev > 20 ? (plev - 20) / 8 + 1 : 0));
			break;
		case 6:
			/* Character Armour */
			(void)set_shield(p_ptr->shield + plev);
			if (plev > 14) (void)set_oppose_acid(p_ptr->oppose_acid + plev);
			if (plev > 19) (void)set_oppose_fire(p_ptr->oppose_fire + plev);
			if (plev > 24) (void)set_oppose_cold(p_ptr->oppose_cold + plev);
			if (plev > 29) (void)set_oppose_elec(p_ptr->oppose_elec + plev);
			if (plev > 34) (void)set_oppose_pois(p_ptr->oppose_pois + plev);
			break;
		case 7:
			ident_spell();
			break;
		case 8:
			if (!get_aim_dir(&dir)) return FALSE; 
			(void)fire_bolt(GF_DOMINATION, dir,
					damroll((plev / 2), (3 + plev / 3)));
			break;
		case 9:
			/* Soul Purge */
			msg_print("The anguish of the dead emanates from your brain!");
			
			(void)project(-1, 2 + plev / 10, p_ptr->py, p_ptr->px,
						  damroll(plev, 4), GF_PSI, PROJECT_KILL);
			break;
		case 10:
			/* Adrenaline */
			(void)set_afraid(0);
			(void)set_stun(0);

			/*
			 * Only heal when Adrenalin Channeling is not active. We check
			 * that by checking if the player isn't fast and 'heroed' atm.
			 */
			if (!p_ptr->fast || !(p_ptr->hero || p_ptr->shero))
			{
				(void)hp_player(plev);
			}

			b = 10 + randint((plev * 3) / 2);
			if (plev < 35)
				(void)set_hero(p_ptr->hero + b);
			else
				(void)set_shero(p_ptr->shero + b);

			if (!p_ptr->fast)
			{
				/* Haste */
				(void)set_fast(b);
			}
			else
			{
				(void)set_fast(p_ptr->fast + b);
			}
			break;
		case 11:
			/* Psychic Drain Turned into MEGA-STUN*/
			if (!get_aim_dir(&dir)) return FALSE;

			b = damroll(plev * 2, 3);

			/* This is always a radius-0 ball now */
			if (fire_ball(GF_STUN, dir, b, 0))
			p_ptr->energy -= randint(150);
			break;
		case 12:
			/* Entropic Blast */
			msg_print
				("A wave of pure entropic force blasts out from your spirit!");
			(void)project(-1, 3 + plev / 10, p_ptr->py, p_ptr->px,
						  plev * (plev > 39 ? 4 : 3), GF_FORCE,
						  PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID);
			break;
		default:
			msg_print("Unknown Mindcrafter power!");
	}


	return TRUE;
}
Example #22
0
bool Cold::Zap(Coord dir)
{
    fire_bolt(game->hero().position(), &dir, "ice");
    discover(false);
    return true;
}
/*
 * Activate a wielded object.  Wielded objects never stack.
 * And even if they did, activatable objects never stack.
 *
 * Currently, only (some) artifacts, and Dragon Scale Mail, can be activated.
 * But one could, for example, easily make an activatable "Ring of Plasma".
 *
 * Note that it always takes a turn to activate an artifact, even if
 * the user hits "escape" at the "direction" prompt.
 */
static bool activate_object(object_type *o_ptr, bool *ident)
{
	int k, dir, i, chance, rod;
	char o_name[80];

	/* Get the basic name of the object */
	rod = object_desc(o_name, sizeof(o_name), o_ptr, FALSE, 0, PAD_IMEN);

	/* Check the recharge */
	if (o_ptr->timeout)
	{
		msg_format("Он%s светится и затухает...",
			(rod == ROD_M ? "" : rod == ROD_F ? "а" : rod == ROD_N ? "о" : "и"));
		return FALSE;
	}

	/* Activate the artifact */
	message(MSG_ZAP, 0, "Вы активируете его...");

	/* Artifacts */
	if (o_ptr->name1)
	{
		artifact_type *a_ptr = &a_info[o_ptr->name1];

		switch (a_ptr->activation)
		{
			case ACT_ILLUMINATION:
			{
				msg_format("%s озаряется чистым светом...", o_name);
				lite_area(damroll(2, 15), 3);
				break;
			}

			case ACT_MAGIC_MAP:
			{
				msg_format("%s ярко сверкает...", o_name);
				map_area();
				break;
			}

			case ACT_CLAIRVOYANCE:
			{
				msg_format("%s светится глубоким зеленым...", o_name);
				wiz_lite();
				(void)detect_traps();
				(void)detect_doors();
				(void)detect_stairs();
				break;
			}

			case ACT_PROT_EVIL:
			{
				msg_format("%s издает протяжный стон...", o_name);
				k = 3 * p_ptr->lev;
				(void)set_protevil(p_ptr->protevil + randint(25) + k);
				break;
			}

			case ACT_DISP_EVIL:
			{
				msg_format("%s заполняет подземелье добром...", o_name);
				dispel_evil(p_ptr->lev * 5);
				break;
			}

			case ACT_HASTE2:
			{
				msg_format("%s ярко светится...", o_name);
				if (!p_ptr->fast)
				{
					(void)set_fast(randint(75) + 75);
				}
				else
				{
					(void)set_fast(p_ptr->fast + 5);
				}
				break;
			}

			case ACT_FIRE3:
			{
				msg_format("%s светится глубоким красным...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_ball(GF_FIRE, dir, 120, 3);
				break;
			}

			case ACT_FROST5:
			{
				msg_format("%s светится ярко-белым...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_ball(GF_COLD, dir, 200, 3);
				break;
			}

			case ACT_ELEC2:
			{
				msg_format("%s светится глубоким синим...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_ball(GF_ELEC, dir, 250, 3);
				break;
			}

			case ACT_BIZZARE:
			{
				msg_format("%s светится черным...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				ring_of_power(dir);
				break;
			}


			case ACT_STAR_BALL:
			{
				msg_format("%s окружается молнией...", o_name);
				for (i = 0; i < 8; i++) fire_ball(GF_ELEC, ddd[i], 150, 3);
				break;
			}

			case ACT_RAGE_BLESS_RESIST:
			{
				msg_format("%s светится всеми цветами...", o_name);
				(void)hp_player(30);
				(void)set_afraid(0);
				(void)set_shero(p_ptr->shero + randint(50) + 50);
				(void)set_blessed(p_ptr->blessed + randint(50) + 50);
				(void)set_oppose_acid(p_ptr->oppose_acid + randint(50) + 50);
				(void)set_oppose_elec(p_ptr->oppose_elec + randint(50) + 50);
				(void)set_oppose_fire(p_ptr->oppose_fire + randint(50) + 50);
				(void)set_oppose_cold(p_ptr->oppose_cold + randint(50) + 50);
				(void)set_oppose_pois(p_ptr->oppose_pois + randint(50) + 50);
				break;
			}

			case ACT_HEAL2:
			{
				msg_format("%s светится ярким белым...", o_name);
				msg_print("Вы чувствуете себя намного лучше...");
				(void)hp_player(1000);
				(void)set_cut(0);
				break;
			}

			case ACT_PHASE:
			{
				msg_format("%s искривляет пространство вокруг вас...", o_name);
				teleport_player(10);
				break;
			}

			case ACT_BANISHMENT:
			{
				msg_format("%s светится угрожающим синим...", o_name);
				if (!banishment()) return FALSE;
				break;
			}

			case ACT_TRAP_DOOR_DEST:
			{
				msg_format("%s светится ярко-красным...", o_name);
				destroy_doors_touch();
				break;
			}

			case ACT_DETECT:
			{
				msg_format("%s светится лучистым белым...", o_name);
				msg_print("Изображение формируется в вашей голове...");
				detect_all();
				break;
			}

			case ACT_HEAL1:
			{
				msg_format("%s светится спокойным синим...", o_name);
				msg_print("Вы чувствуете теплое покалывание...");
				(void)hp_player(500);
				(void)set_cut(0);
				break;
			}

			case ACT_RESIST:
			{
				msg_format("%s светится цветами радуги...", o_name);
				(void)set_oppose_acid(p_ptr->oppose_acid + randint(20) + 20);
				(void)set_oppose_elec(p_ptr->oppose_elec + randint(20) + 20);
				(void)set_oppose_fire(p_ptr->oppose_fire + randint(20) + 20);
				(void)set_oppose_cold(p_ptr->oppose_cold + randint(20) + 20);
				(void)set_oppose_pois(p_ptr->oppose_pois + randint(20) + 20);
				break;
			}

			case ACT_SLEEP:
			{
				msg_format("%s светится ярко-синим...", o_name);
				sleep_monsters_touch();
				break;
			}

			case ACT_RECHARGE1:
			{
				msg_format("%s светится ярко-желтым...", o_name);
				recharge(60);
				break;
			}

			case ACT_TELEPORT:
			{
				msg_format("%s распрямляет пространство вокруг вас...", o_name);
				teleport_player(100);
				break;
			}

			case ACT_RESTORE_LIFE:
			{
				msg_format("%s светится спокойным красным...", o_name);
				restore_level();
				break;
			}

			case ACT_MISSILE:
			{
				msg_format("%s ярко горит...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_bolt(GF_MISSILE, dir, damroll(2, 6));
				break;
			}

			case ACT_FIRE1:
			{
				msg_format("%s покрывается пламенем...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_bolt(GF_FIRE, dir, damroll(9, 8));
				break;
			}

			case ACT_FROST1:
			{
				msg_format("%s излучает холод...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_bolt(GF_COLD, dir, damroll(6, 8));
				break;
			}

			case ACT_LIGHTNING_BOLT:
			{
				msg_format("%s сыплет искрамиs...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_bolt(GF_ELEC, dir, damroll(4, 8));
				break;
			}

			case ACT_ACID1:
			{
				msg_format("%s покрывается кислотой...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_bolt(GF_ACID, dir, damroll(5, 8));
				break;
			}

			case ACT_ARROW:
			{
				msg_format("%s покрывается шипами...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_bolt(GF_ARROW, dir, 150);
				break;
			}

			case ACT_HASTE1:
			{
				msg_format("%s светится ярко-зеленым...", o_name);
				if (!p_ptr->fast)
				{
					(void)set_fast(randint(20) + 20);
				}
				else
				{
					(void)set_fast(p_ptr->fast + 5);
				}
				break;
			}

			case ACT_REM_FEAR_POIS:
			{
				msg_format("%s вспыхивает синим...", o_name);
				(void)set_afraid(0);
				(void)set_poisoned(0);
				break;
			}

			case ACT_STINKING_CLOUD:
			{
				msg_format("%s светится ядовито-зеленым...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_ball(GF_POIS, dir, 12, 3);
				break;
			}

			case ACT_FROST2:
			{
				msg_format("%s покрывается инеем...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_ball(GF_COLD, dir, 48, 2);
				break;
			}

			case ACT_FROST4:
			{
				msg_format("%s горит бледно-синим...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_bolt(GF_COLD, dir, damroll(12, 8));
				break;
			}

			case ACT_FROST3:
			{
				msg_format("%s светится насыщенным синим...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_ball(GF_COLD, dir, 100, 2);
				break;
			}

			case ACT_FIRE2:
			{
				msg_format("%s пылает огнем...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_ball(GF_FIRE, dir, 72, 2);
				break;
			}

			case ACT_DRAIN_LIFE2:
			{
				msg_format("%s светится черным...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				drain_life(dir, 120);
				break;
			}

			case ACT_STONE_TO_MUD:
			{
				msg_format("%s пульсирует...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				wall_to_mud(dir);
				break;
			}

			case ACT_MASS_BANISHMENT:
			{
				msg_format("%s издает протяжную ноту...", o_name);
				(void)mass_banishment();
				break;
			}

			case ACT_CURE_WOUNDS:
			{
				msg_format("%s светится глубоким фиолетовым...", o_name);
				hp_player(damroll(4, 8));
				(void)set_cut((p_ptr->cut / 2) - 50);
				break;
			}

			case ACT_TELE_AWAY:
			{
				msg_format("%s вспыхивает глубоким красным...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				teleport_monster(dir);
				break;
			}

			case ACT_WOR:
			{
				msg_format("%s светится мягким белым...", o_name);
				set_recall();
				break;
			}

			case ACT_CONFUSE:
			{
				msg_format("%s светится странными цветами...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				confuse_monster(dir, 20);
				break;
			}

			case ACT_IDENTIFY:
			{
				msg_format("%s вспыхивает желтым...", o_name);
				if (!ident_spell()) return FALSE;
				break;
			}

			case ACT_PROBE:
			{
				msg_format("%s ярко загорается...", o_name);
				probing();
				break;
			}

			case ACT_DRAIN_LIFE1:
			{
				msg_format("%s горит белым...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				drain_life(dir, 90);
				break;
			}

			case ACT_FIREBRAND:
			{
				msg_format("%s светится огненно-красным...", o_name);
				(void)brand_bolts();
				break;
			}

			case ACT_STARLIGHT:
			{
				msg_format("%s вспыхивает светом тысячи звезд...", o_name);
				for (k = 0; k < 8; k++) strong_lite_line(ddd[k]);
				break;
			}

			case ACT_MANA_BOLT:
			{
				msg_format("%s светится белым...", o_name);
				if (!get_aim_dir(&dir)) return FALSE;
				fire_bolt(GF_MANA, dir, damroll(12, 8));
				break;
			}

			case ACT_BERSERKER:
			{
				msg_format("%s горит яростью...", o_name);
				set_shero(p_ptr->shero + randint(50) + 50);
				break;
			}
		}

		/* Set the recharge time */
		if (a_ptr->randtime)
			o_ptr->timeout = a_ptr->time + (byte)randint(a_ptr->randtime);
		else
			o_ptr->timeout = a_ptr->time;

		/* Window stuff */
		p_ptr->window |= (PW_INVEN | PW_EQUIP);

		/* Done */
		return FALSE;
	}


	/* Hack -- Dragon Scale Mail can be activated as well */
	if (o_ptr->tval == TV_DRAG_ARMOR)
	{
		/* Get a direction for breathing (or abort) */
		if (!get_aim_dir(&dir)) return FALSE;

		/* Branch on the sub-type */
		switch (o_ptr->sval)
		{
			case SV_DRAGON_BLUE:
			{
				msg_print("Вы дышите молнией.");
				fire_ball(GF_ELEC, dir, 100, 2);
				o_ptr->timeout = rand_int(450) + 450;
				break;
			}

			case SV_DRAGON_WHITE:
			{
				msg_print("Вы дышите холодом.");
				fire_ball(GF_COLD, dir, 110, 2);
				o_ptr->timeout = rand_int(450) + 450;
				break;
			}

			case SV_DRAGON_BLACK:
			{
				msg_print("Вы дышите кислотой.");
				fire_ball(GF_ACID, dir, 130, 2);
				o_ptr->timeout = rand_int(450) + 450;
				break;
			}

			case SV_DRAGON_GREEN:
			{
				msg_print("Вы дышите ядовитым газом.");
				fire_ball(GF_POIS, dir, 150, 2);
				o_ptr->timeout = rand_int(450) + 450;
				break;
			}

			case SV_DRAGON_RED:
			{
				msg_print("Вы дышите огнем.");
				fire_ball(GF_FIRE, dir, 200, 2);
				o_ptr->timeout = rand_int(450) + 450;
				break;
			}

			case SV_DRAGON_MULTIHUED:
			{
				chance = rand_int(5);
				msg_format("Вы дышите %s.",
				           ((chance == 1) ? "молнией" :
				            ((chance == 2) ? "холодом" :
				             ((chance == 3) ? "кислотой" :
				              ((chance == 4) ? "ядовитым газом" : "огнем")))));
				fire_ball(((chance == 1) ? GF_ELEC :
				           ((chance == 2) ? GF_COLD :
				            ((chance == 3) ? GF_ACID :
				             ((chance == 4) ? GF_POIS : GF_FIRE)))),
				          dir, 250, 2);
				o_ptr->timeout = rand_int(225) + 225;
				break;
			}

			case SV_DRAGON_BRONZE:
			{
				msg_print("Вы дышите контузией.");
				fire_ball(GF_CONFUSION, dir, 120, 2);
				o_ptr->timeout = rand_int(450) + 450;
				break;
			}

			case SV_DRAGON_GOLD:
			{
				msg_print("Вы дышите звуком.");
				fire_ball(GF_SOUND, dir, 130, 2);
				o_ptr->timeout = rand_int(450) + 450;
				break;
			}

			case SV_DRAGON_CHAOS:
			{
				chance = rand_int(2);
				msg_format("Вы дышите %s.",
				           ((chance == 1 ? "хаосом" : "антимагией")));
				fire_ball((chance == 1 ? GF_CHAOS : GF_DISENCHANT),
				          dir, 220, 2);
				o_ptr->timeout = rand_int(300) + 300;
				break;
			}

			case SV_DRAGON_LAW:
			{
				chance = rand_int(2);
				msg_format("Вы дышите %s.",
				           ((chance == 1 ? "звуком" : "осколками")));
				fire_ball((chance == 1 ? GF_SOUND : GF_SHARD),
				          dir, 230, 2);
				o_ptr->timeout = rand_int(300) + 300;
				break;
			}

			case SV_DRAGON_BALANCE:
			{
				chance = rand_int(4);
				msg_format("Вы дышите %s.",
				           ((chance == 1) ? "хаосом" :
				            ((chance == 2) ? "антимагией" :
				             ((chance == 3) ? "звуком" : "осколками"))));
				fire_ball(((chance == 1) ? GF_CHAOS :
				           ((chance == 2) ? GF_DISENCHANT :
				            ((chance == 3) ? GF_SOUND : GF_SHARD))),
				          dir, 250, 2);
				o_ptr->timeout = rand_int(300) + 300;
				break;
			}

			case SV_DRAGON_SHINING:
			{
				chance = rand_int(2);
				msg_format("Вы дышите %s.",
				           ((chance == 0 ? "светом" : "темнотой")));
				fire_ball((chance == 0 ? GF_LITE : GF_DARK), dir, 200, 2);
				o_ptr->timeout = rand_int(300) + 300;
				break;
			}

			case SV_DRAGON_POWER:
			{
				msg_print("Вы дышите элементами.");
				fire_ball(GF_MISSILE, dir, 300, 2);
				o_ptr->timeout = rand_int(300) + 300;
				break;
			}
		}

		/* Window stuff */
		p_ptr->window |= (PW_INVEN | PW_EQUIP);

		/* Success */
		return FALSE;
	}

	/* Hack -- some Rings can be activated for double resist and element ball */
	if (o_ptr->tval == TV_RING)
	{
		/* Get a direction for firing (or abort) */
		if (!get_aim_dir(&dir)) return FALSE;

		/* Branch on the sub-type */
		switch (o_ptr->sval)
		{
			case SV_RING_ACID:
			{
				fire_ball(GF_ACID, dir, 70, 2);
				set_oppose_acid(p_ptr->oppose_acid + randint(20) + 20);
				o_ptr->timeout = rand_int(50) + 50;
				break;
			}

			case SV_RING_FLAMES:
			{
				fire_ball(GF_FIRE, dir, 80, 2);
				set_oppose_fire(p_ptr->oppose_fire + randint(20) + 20);
				o_ptr->timeout = rand_int(50) + 50;
				break;
			}

			case SV_RING_ICE:
			{
				fire_ball(GF_COLD, dir, 75, 2);
				set_oppose_cold(p_ptr->oppose_cold + randint(20) + 20);
				o_ptr->timeout = rand_int(50) + 50;
				break;
			}

			case SV_RING_LIGHTNING:
			{
				fire_ball(GF_ELEC, dir, 85, 2);
				set_oppose_elec(p_ptr->oppose_elec + randint(20) + 20);
				o_ptr->timeout = rand_int(50) + 50;
				break;
			}
		}

		/* Window stuff */
		p_ptr->window |= (PW_EQUIP);

		/* Success */
		return FALSE;
	}

	/* Mistake */
	msg_print("Oops.  That object cannot be activated.");

	/* Not used up */
	return (FALSE);
}