Exemple #1
0
static void _excavation_spell(int cmd, variant *res)
{
    switch (cmd)
    {
    case SPELL_NAME:
        var_set_string(res, "Excavation");
        break;
    case SPELL_DESC:
        var_set_string(res, "You break walls on your quest for treasure!  This takes a bit more time, though.");
        break;
    case SPELL_ENERGY:
        {
            int n = 200;
            
            if (equip_find_object(TV_DIGGING, SV_ANY))
                n -= 120 * p_ptr->lev / 50;
            else
                n -= 80 * p_ptr->lev / 50;

            var_set_int(res, n);
        }
        break;
    case SPELL_CAST:
        {
            int dir = 5;
            bool b = FALSE;

            if ( get_rep_dir2(&dir)
              && dir != 5 )
            {
                int x, y;
                y = py + ddy[dir];
                x = px + ddx[dir];

                if (!in_bounds(y, x))
                {
                    msg_print("You may excavate no further.");
                }
                else if ( cave_have_flag_bold(y, x, FF_WALL)
                       || cave_have_flag_bold(y, x, FF_TREE) 
                       || cave_have_flag_bold(y, x, FF_CAN_DIG) )
                {
                    msg_print("You dig your way to treasure!");
                    cave_alter_feat(y, x, FF_TUNNEL);
                    teleport_player_to(y, x, TELEPORT_NONMAGICAL); /*??*/
                    b = TRUE;
                }
                else
                {
                    msg_print("There is nothing to excavate.");
                }
            }
            var_set_bool(res, b);
        }
        break;
    default:
        default_spell(cmd, res);
        break;
    }
}
Exemple #2
0
/*
 * Refill the players lamp, or restock his torches
 */
void do_cmd_refill(void)
{
    int slot = equip_find_object(TV_LITE, SV_ANY);

    if (slot)
    {
        object_type *o_ptr = equip_obj(slot);

        if (p_ptr->special_defense & KATA_MUSOU)
            set_action(ACTION_NONE);

        switch (o_ptr->sval)
        {
        case SV_LITE_LANTERN:
            do_cmd_refill_lamp(o_ptr);
            break;
        case SV_LITE_TORCH:
            do_cmd_refill_torch(o_ptr);
            break;
        default:
            msg_print("Your light cannot be refilled.");
        }
    }
    else
        msg_print("You are not wielding a light.");
}
Exemple #3
0
static void _sniping_spell(int cmd, variant *res)
{
    switch (cmd)
    {
    case SPELL_NAME:
        var_set_string(res, "Sniping");
        break;
    case SPELL_DESC:
        var_set_string(res, "Shoot a sleeping enemy sentry with great precision.");
        break;
    case SPELL_CAST:
        var_set_bool(res, FALSE);
        if (!equip_find_object(TV_BOW, SV_ANY))
        {
            msg_print("You need a bow to use this talent.");
            break;
        }
        shoot_hack = SHOOT_SNIPING;
        command_cmd = 'f'; /* Hack for inscriptions (e.g. '@f1') */
        var_set_bool(res, do_cmd_fire());
        shoot_hack = SHOOT_NONE;
        break;
    default:
        default_spell(cmd, res);
        break;
    }
}
Exemple #4
0
/* Check for valid equipment.  Note, the pointer we return
   will point to a descriptive error message indefinitely.
   We don't use format(...).  Also, different messages will
   have different addresses, so that _calc_bonuses() can
   keep the user up to date as to why their powers don't work. */
cptr _equip_error(void)
{
    int wgt = equip_weight(object_is_armour);

    if (wgt > (100 + (p_ptr->lev * 4)))
        return "The weight of your equipment is disrupting your talents.";

    if (equip_find_object(TV_SHIELD, SV_ANY) || equip_find_object(TV_CAPTURE, SV_ANY))
        return "Your shield is disrupting your talents.";

    if (p_ptr->weapon_ct > 1)
        return "Dual wielding is disrupting your talents.";

    if (equip_find_object(TV_SWORD, SV_POISON_NEEDLE))
        return "The Poison Needle is not an honorable dueling weapon.";

    if (p_ptr->anti_magic)
        return "An anti-magic barrier disrupts your talents.";

    return NULL;
}
Exemple #5
0
void display_shooter_info(doc_ptr doc)
{
    object_type *bow_ptr = NULL;
    int          slot = equip_find_object(TV_BOW, SV_ANY);
    char         o_name[MAX_NLEN];
    int          mult;
    int          num_fire = 0;
    int          to_h = 0;
    int          to_d = 0;
    int          i, j;

    if (!slot || prace_is_(RACE_MON_JELLY) || p_ptr->shooter_info.tval_ammo == TV_NO_AMMO)
        return;

    bow_ptr = equip_obj(slot);
    assert(bow_ptr);

    mult = bow_mult(bow_ptr);

    if (p_ptr->shooter_info.num_fire)
        num_fire = p_ptr->shooter_info.num_fire * 100 * 100 / bow_energy(bow_ptr->sval);

    if (object_is_known(bow_ptr))
    {
        to_h = bow_ptr->to_h;
        to_d = bow_ptr->to_d;
        if (weaponmaster_is_(WEAPONMASTER_CROSSBOWS) && p_ptr->lev >= 15)
            to_d += 1 + p_ptr->lev/10;
    }

    /* Shooter */
    object_desc(o_name, bow_ptr, OD_OMIT_INSCRIPTION | OD_COLOR_CODED);
    doc_printf(doc, " <color:y>Shooting</color>: <indent><style:indent>%s</style></indent>\n", o_name);
    
    doc_printf(doc, " %-8.8s: %d'\n", "Range", (bow_range(bow_ptr) + 1) * 10);
    doc_printf(doc, " %-8.8s: %d.%02d\n", "Shots", num_fire/100, num_fire%100);
    doc_printf(doc, " %-8.8s: %d.%02dx\n", "Mult", mult/100, mult%100);
    doc_printf(doc, " %-8.8s: %d + %d = %d\n", "To Hit", to_h, p_ptr->shooter_info.dis_to_h, to_h + p_ptr->shooter_info.dis_to_h);
    doc_printf(doc, " %-8.8s: %d (%s)\n", "To Dam", to_d, "Multiplier Applies");
    doc_printf(doc, " %-8.8s: %d (%s)\n", "Xtra Dam", p_ptr->shooter_info.dis_to_d, "Multiplier Does Not Apply");
    doc_newline(doc);

    /* Ammo */
    j = 0;
    for (i = 0; i < INVEN_PACK; i++)
    {
        if (inventory[i].tval == p_ptr->shooter_info.tval_ammo)
            _shooter_info_aux(doc, bow_ptr, &inventory[i], ++j);
    }

}
static bool cast_sniper_spell(int spell)
{
    if (!equip_find_object(TV_BOW, SV_ANY))
    {
        msg_print("You wield no bow!");
        return (FALSE);
    }

    /* spell code */
    switch (spell)
    {
    case 0: /* Concentration */
        if (!snipe_concentrate()) return (FALSE);
        energy_use = 100;
        return (TRUE);
    case 1: snipe_type = SP_LITE; break;
    case 2: snipe_type = SP_AWAY; break;
    case 3: snipe_type = SP_KILL_TRAP; break;
    case 4: snipe_type = SP_FIRE; break;
    case 5: snipe_type = SP_KILL_WALL; break;
    case 6: snipe_type = SP_COLD; break;
    case 7: snipe_type = SP_RUSH; break;
    case 8: snipe_type = SP_PIERCE; break;
    case 9: snipe_type = SP_EVILNESS; break;
    case 10: snipe_type = SP_HOLYNESS; break;
    case 11: snipe_type = SP_EXPLODE; break;
    case 12: snipe_type = SP_DOUBLE; break;
    case 13: snipe_type = SP_ELEC; break;
    case 14: snipe_type = SP_NEEDLE; break;
    case 15: snipe_type = SP_FINAL; break;
    default:
        msg_print("Zap?");
    }

    command_cmd = 'f';
    do_cmd_fire();
    snipe_type = 0;
    return is_fired;
}