Exemplo n.º 1
0
int res_ct_known(int which)
{
    int ct = p_ptr->resist[which];
    int hidden = 0;
    int flg = res_get_object_flag(which);
    int i;

    /* Life is a bit hard at the moment since "player flags"
       may account for multiple resistances. Really, the entire
       flag based approach to resistance is just wrong, but I'm
       too lazy to fix ...
    */
    for (i = 0; i < equip_count(); i++)
    {
        int          slot = EQUIP_BEGIN + i;
        object_type *o_ptr = equip_obj(slot);
        u32b         flgs[TR_FLAG_SIZE];
        u32b         flgs_known[TR_FLAG_SIZE];

        if (!o_ptr) continue;
        object_flags(o_ptr, flgs);
        object_flags_known(o_ptr, flgs_known);

        if (have_flag(flgs, flg) && !have_flag(flgs_known, flg))
            hidden++;
    }

    ct -= hidden;
    return ct;
}
Exemplo n.º 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.");
}
Exemplo n.º 3
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);
    }

}
Exemplo n.º 4
0
static void _centaur_calc_bonuses(void)
{
    int slot = equip_find_first(object_is_body_armour);
    p_ptr->pspeed += p_ptr->lev / 10;

    if (slot)
    {
        object_type *o_ptr = equip_obj(slot);
        p_ptr->to_a -= o_ptr->ac / 3;
        p_ptr->to_a -= o_ptr->to_a / 3;

        p_ptr->dis_to_a -= o_ptr->ac / 3;
        p_ptr->dis_to_a -= o_ptr->to_a / 3;
    }
}
Exemplo n.º 5
0
int calculate_base_blows(int hand, int str_idx, int dex_idx)
{
    int            result = 0;
    weapon_info_t *info_ptr = &p_ptr->weapon_info[hand];
    object_type   *o_ptr = NULL;
    int            blow_str_idx;
    int            div = 0;
    int            mul = 0;
    int            wgt = 0;
    _blow_info_t   blow_info = {0};
    _range_t       rng = _blows_range[dex_idx];

    if (info_ptr->wield_how == WIELD_NONE) return 0;

    o_ptr = equip_obj(info_ptr->slot);
    if (!o_ptr) return 0;
    if (info_ptr->heavy_wield) return 100;

    blow_info = _get_blow_info(hand);

    wgt = o_ptr->weight;
    div = (wgt < blow_info.wgt) ? blow_info.wgt : wgt;
    mul = blow_info.mul + info_ptr->giant_wield * 10;

    blow_str_idx = adj_str_blow[str_idx] * mul / div; /* Scaled by 10 */
    if (info_ptr->wield_how == WIELD_TWO_HANDS)
    {
        if (!info_ptr->omoi)
            blow_str_idx += 10;
        if (prace_is_(RACE_MON_GIANT) && giant_is_favorite(o_ptr)) 
            blow_str_idx += 10;
    }
    if (p_ptr->pclass == CLASS_NINJA) blow_str_idx = MAX(0, blow_str_idx-10);
    if (blow_str_idx > 110) blow_str_idx = 110;

    result = rng.min + (rng.max - rng.min) * blow_str_idx / 110;

    if (p_ptr->pclass == CLASS_MAULER)
        result = 100 + (result - 100)/8;
        
    if (result > blow_info.num) 
        result = blow_info.num;

    if (result < 100)
        result = 100;

    return result;
}
Exemplo n.º 6
0
static void _ac_bonus_imp(int slot)
{
    if (!equip_obj(slot))
    {
        switch (equip_slot_type(slot))
        {
        case EQUIP_SLOT_BODY_ARMOR:
            p_ptr->to_a += p_ptr->lev*3/2;
            p_ptr->dis_to_a += p_ptr->lev*3/2;
            break;
        case EQUIP_SLOT_CLOAK:
            if (p_ptr->lev > 15)
            {
                p_ptr->to_a += (p_ptr->lev - 13)/3;
                p_ptr->dis_to_a += (p_ptr->lev - 13)/3;
            }
            break;
        case EQUIP_SLOT_WEAPON_SHIELD: /* Oops: was INVEN_LARM only and "/3" ... */
            if (p_ptr->lev > 10)
            {
                p_ptr->to_a += (p_ptr->lev - 8)/6;
                p_ptr->dis_to_a += (p_ptr->lev - 8)/6;
            }
            break;
        case EQUIP_SLOT_HELMET:
            if (p_ptr->lev >= 5)
            {
                p_ptr->to_a += (p_ptr->lev - 2)/3;
                p_ptr->dis_to_a += (p_ptr->lev - 2)/3;
            }
            break;
        case EQUIP_SLOT_GLOVES:
            p_ptr->to_a += p_ptr->lev/2;
            p_ptr->dis_to_a += p_ptr->lev/2;
            break;
        case EQUIP_SLOT_BOOTS:
            p_ptr->to_a += p_ptr->lev/3;
            p_ptr->dis_to_a += p_ptr->lev/3;
            break;
        }
    }
}
Exemplo n.º 7
0
/* Confirm 1 or 2 whip weapons for whip techniques. Fail if no whip
   is worn, or if a non-whip weapon is warn. Do not fail if shields
   or capture balls are equipped. Handle empty inventory slots. */
static bool _whip_check(void)
{
    bool result = FALSE;
    int i;

    for (i = 0; i < MAX_HANDS; i++)
    {
        object_type *o = NULL;
        if (p_ptr->weapon_info[i].wield_how != WIELD_NONE)
            o = equip_obj(p_ptr->weapon_info[i].slot);
        if (o)
        {
            if (object_is_(o, TV_HAFTED, SV_WHIP))
                result = TRUE; /* Found a whip weapon */
            else
                return FALSE; /* Found a non-whip weapon */
        }
    }
    return result;
}
/**********************************************************************
 * Utilities
 **********************************************************************/
static bool _necro_check_touch(void)
{
    int slot;
    if (p_ptr->afraid)
    {
        msg_print("You are too scared to do that!");
        return FALSE;
    }
    if (!equip_find_empty_hand() && !mut_present(MUT_DRACONIAN_METAMORPHOSIS))
    {
        msg_print("You need a free hand to touch.");
        return FALSE;
    }

    slot = equip_find_obj(TV_GLOVES, SV_ANY);
    if (slot && equip_obj(slot)->name1 != ART_HAND_OF_VECNA)
    {
        msg_print("You can't touch while wielding gloves.");
        return FALSE;
    }
    return TRUE;
}
Exemplo n.º 9
0
static _blow_info_t _get_blow_info(int hand)
{
    _blow_info_t result = {0};
    int          arm = hand / 2;
    object_type *o_ptr = equip_obj(p_ptr->weapon_info[hand].slot);

    if (!o_ptr) return result;

    /* TODO: Use race_ptr and class_ptr instead of this giant switch ... */
    switch (p_ptr->pclass)
    {
    case CLASS_WARRIOR:
        result.num = 600; result.wgt = 70; result.mul = 50 + p_ptr->lev/2;
        break;

    case CLASS_MAULER:
        result.num = 175; result.wgt = 280; result.mul = 75; break;

    case CLASS_BERSERKER:
        result.num = 600; result.wgt = 70; result.mul = 75; break;

    case CLASS_RAGE_MAGE:
        result.num = 300; result.wgt = 70; result.mul = 30; break;
                    
    case CLASS_MAGE:
    case CLASS_NECROMANCER:
    case CLASS_BLOOD_MAGE:
    case CLASS_HIGH_MAGE:
    case CLASS_BLUE_MAGE:
        result.num = 400; result.wgt = 100; result.mul = 20; break;

    case CLASS_WARLOCK:
        result.num = 400; result.wgt = 100; result.mul = 35;
        switch (p_ptr->psubclass)
        {
        case WARLOCK_DRAGONS:
            if ( p_ptr->riding
              && (object_is_(o_ptr, TV_POLEARM, SV_LANCE) || object_is_(o_ptr, TV_POLEARM, SV_HEAVY_LANCE)) )
            {
                result.mul = 65;
            }
            break;
        case WARLOCK_ANGELS:
        case WARLOCK_DEMONS:
            result.num = 450;
            break;
        case WARLOCK_HOUNDS:
            result.num = 475;
            break;
        case WARLOCK_GIANTS:
            result.wgt = 200;
            result.mul = 50 + p_ptr->lev/5;
            result.num = 500;
            break;
        }
        break;

    case CLASS_PSION:
        result.num = 400; result.wgt = 100; result.mul = 30; break;

    case CLASS_PRIEST:
    case CLASS_MAGIC_EATER:
    case CLASS_MINDCRAFTER:
        result.num = 500; result.wgt = 100; result.mul = 35; break;

    case CLASS_DEVICEMASTER:
        result.num = 400; result.wgt = 100; result.mul = 35;
        if (p_ptr->psubclass == DEVICEMASTER_POTIONS || p_ptr->psubclass == DEVICEMASTER_SCROLLS)
            result.num = 500;
        break;

    case CLASS_ROGUE:
        result.num = 525; result.wgt = 40; result.mul = 30;
        if (o_ptr->weight < 50) result.num = 600;
        break;

    case CLASS_SCOUT:
        result.num = 400; result.wgt = 70; result.mul = 25; break;

    case CLASS_RANGER:
        result.num = 500; result.wgt = 70; result.mul = 40; break;

    case CLASS_PALADIN:
    case CLASS_SAMURAI:
        result.num = 550; result.wgt = 70; result.mul = 45; break;

    case CLASS_MYSTIC:
        result.num = 100; result.wgt = 100; result.mul = 10; break;

    case CLASS_WEAPONSMITH:
    case CLASS_RUNE_KNIGHT:
        result.num = 525; result.wgt = 150; result.mul = 55; break;

    case CLASS_WEAPONMASTER:
        result.num = weaponmaster_get_max_blows(o_ptr, hand); 
        result.wgt = 70; result.mul = 50; break;

    case CLASS_WARRIOR_MAGE:
    case CLASS_RED_MAGE:
        result.num = 525; result.wgt = 70; result.mul = 30; break;

    case CLASS_CHAOS_WARRIOR:
        result.num = 550; result.wgt = 70; result.mul = 45; break;

    case CLASS_MONK:
        result.num = 500; result.wgt = 60; result.mul = 30; break;

    case CLASS_TOURIST:
    case CLASS_TIME_LORD:
        result.num = 400; result.wgt = 100; result.mul = 30; break;

    case CLASS_ARCHAEOLOGIST:
        result.num = 400; result.wgt = 70; result.mul = 30;
        if (archaeologist_is_favored_weapon(o_ptr))
        {
            result.num = 500;
            result.mul = 40;
        }
        break;

    case CLASS_BLOOD_KNIGHT:
        result.num = 300; result.wgt = 150; result.mul = 30; break;

    case CLASS_DUELIST:
        result.num = 100; result.wgt = 70; result.mul = 40; break;
                    
    case CLASS_IMITATOR:
        result.num = 550; result.wgt = 70; result.mul = 40; break;

    case CLASS_WILD_TALENT:
        result.num = 450; result.wgt = 70; result.mul = 40; break;

    case CLASS_BEASTMASTER:
        result.num = 500; result.wgt = 70; result.mul = 35; break;

    case CLASS_CAVALRY:
    {
        u32b flgs[TR_FLAG_SIZE];
        object_flags(o_ptr, flgs);
        if (p_ptr->riding && have_flag(flgs, TR_RIDING)) {result.num = 550; result.wgt = 70; result.mul = 65;}
        else {result.num = 500; result.wgt = 100; result.mul = 35;}
        break;
    }
    case CLASS_SORCERER:
        result.num = 100; result.wgt = 1; result.mul = 10; break;

    case CLASS_ARCHER:
    case CLASS_BARD:
        result.num = 450; result.wgt = 70; result.mul = 20; break;

    case CLASS_FORCETRAINER:
        result.num = 400; result.wgt = 60; result.mul = 20; break;

    case CLASS_MIRROR_MASTER:
    case CLASS_SNIPER:
        result.num = 400; result.wgt = 100; result.mul = 30; break;

    case CLASS_NINJA:
        result.num = 425; result.wgt = 20; result.mul = 10; break;

    case CLASS_MONSTER:
        result.num = 500; result.wgt = 70; result.mul = 50;
        if (prace_is_(RACE_MON_LICH)) 
        {
            result.num = 400;
            result.mul = 30;
        }
        else if (prace_is_(RACE_MON_POSSESSOR))
        {
            result.num = 400;
        }
        else if (prace_is_(RACE_MON_MIMIC)) 
        {
            result.num = 400;
        }
        else if (prace_is_(RACE_MON_TROLL))
        {
            result.num = 550;
        }
        else if (prace_is_(RACE_MON_GIANT))
        {
            result.num = 550;
            result.mul = 50 + p_ptr->lev/5;
            result.wgt = 200;
            if (giant_is_(GIANT_HRU) && p_ptr->lev >= 40)
                result.mul = 80;
        }
        else if ( prace_is_(RACE_MON_JELLY)
               || demon_is_(DEMON_KHORNE) )  
        {
            result.num = 600;
            result.mul = 50 + p_ptr->lev/5;
        }
        else if (prace_is_(RACE_MON_LEPRECHAUN)) 
        {
            result.num = 300;
            result.mul = 20;
        }
        else if (prace_is_(RACE_MON_SWORD))
        {
            result.num = 525;
            if (p_ptr->lev >= 45) /* Death Scythes retaliate! */
                result.num = 300;
        }
        else if (prace_is_(RACE_MON_GOLEM))
        {
            result.num = 100;
        }
        break;
    }

    if (hex_spelling(HEX_XTRA_MIGHT) || hex_spelling(HEX_BUILDING) || p_ptr->tim_building_up)
    {
        result.wgt /= 2;
        result.mul += 20;
    }

    /* Xorns and Mariliths have multiple sets of arms */
    if (arm > 0)
        result.num -= 100;
    if (result.num < 100)
        result.num = 100;

    if (o_ptr->tval == TV_SWORD && o_ptr->sval == SV_POISON_NEEDLE) 
        result.num = 100;

    return result;
}
Exemplo n.º 10
0
void display_weapon_info(doc_ptr doc, int hand)
{
    object_type *o_ptr = equip_obj(p_ptr->weapon_info[hand].slot);
    char o_name[MAX_NLEN];
    u32b flgs[TR_FLAG_SIZE];
    int dd;
    int ds;
    int to_d = 0;
    int to_h = 0;
    int mult;
    critical_t crit = {0};
    int crit_pct = 0;
    int num_blow = NUM_BLOWS(hand);
    bool force = FALSE;
    doc_ptr cols[2] = {0};

    if (p_ptr->weapon_info[hand].wield_how == WIELD_NONE) return;
    if (!o_ptr) return;

    dd = o_ptr->dd + p_ptr->weapon_info[hand].to_dd;
    ds = o_ptr->ds + p_ptr->weapon_info[hand].to_ds;
    if (object_is_known(o_ptr))
    {
        to_d = o_ptr->to_d;
        to_h = o_ptr->to_h;
    }

    switch (display_weapon_mode)
    {
    case MAULER_STUNNING_BLOW:
    case MAULER_CRITICAL_BLOW:
    case MAULER_CRUSHING_BLOW:
    case MAULER_KNOCKBACK:
        num_blow = 100;
        break;
    case MAULER_KNOCKOUT_BLOW:
        num_blow = 100;
        to_h -= 50;
        break;
    case PY_POWER_ATTACK:
        to_h += 10;
        to_d += p_ptr->lev / 2;
        break;
    }

    weapon_flags_known(hand, flgs);
    if ( (have_flag(flgs, TR_FORCE_WEAPON) || p_ptr->tim_force) 
      && (p_ptr->csp > o_ptr->dd*o_ptr->ds/5) )
    {
        force = TRUE;
    }

    if (weaponmaster_get_toggle() == TOGGLE_SHIELD_BASH && object_is_shield(o_ptr))
    {
        dd = 3 + p_ptr->weapon_info[hand].to_dd;
        ds = o_ptr->ac + p_ptr->weapon_info[hand].to_ds;
        if (object_is_known(o_ptr))
        {
            to_h = o_ptr->to_a;
            to_d = o_ptr->to_a;
            to_h += 2*o_ptr->to_h;
            to_d += 2*o_ptr->to_d;
        }
    }

    mult = 100;
    if (have_flag(flgs, TR_VORPAL2))
        mult = mult * 5 / 3;
    else if (have_flag(flgs, TR_VORPAL))
        mult = mult * 11 / 9;

    mult += mult * p_ptr->weapon_info[hand].to_mult / 100;

    if (display_weapon_mode == MAULER_CRUSHING_BLOW)
    {
        int d = p_ptr->lev/5;
        int n = 10*(1 + d)/2; /* scale by 10 */

        mult = mult * (50 + n)/30;
    }

    if (!have_flag(flgs, TR_ORDER))
    {
        const int attempts = 10 * 1000;
        int i;
        int crits = 0;
        /* Compute Average Effects of Criticals by sampling */
        for (i = 0; i < attempts; i++)
        {
            critical_t tmp = critical_norm(o_ptr->weight, to_h, p_ptr->weapon_info[hand].to_h, display_weapon_mode, hand);
            if (tmp.desc)
            {
                crit.mul += tmp.mul;
                crit.to_d += tmp.to_d;
                crits++;
            }
            else
                crit.mul += 100;
        }
        crit.mul = crit.mul / attempts;
        crit.to_d = crit.to_d * 100 / attempts;
        crit_pct = crits * 1000 / attempts;
    }
    else
        crit.mul = 100;


    /* Display in 2 columns, side by side */
    cols[0] = doc_alloc(60);
    cols[1] = doc_alloc(10);

    /* Column #1 */
    object_desc(o_name, o_ptr, OD_COLOR_CODED | OD_NAME_AND_ENCHANT);
    if (prace_is_(RACE_MON_SWORD))
        doc_printf(cols[0], "<color:y> You    :</color> <indent><style:indent>%s</style></indent>\n", o_name);
    else
        doc_printf(cols[0], "<color:y> Hand #%d:</color> <indent><style:indent>%s</style></indent>\n", hand+1, o_name);

    doc_printf(cols[0], " %-7.7s: %d.%d lbs\n", "Weight", o_ptr->weight/10, o_ptr->weight%10);

    if (weaponmaster_get_toggle() == TOGGLE_SHIELD_BASH)
    {
        assert(o_ptr->tval == TV_SHIELD);
        doc_printf(cols[0], " %-7.7s: %dd%d (%+d,%+d)\n", "Bash", dd, ds, to_h, to_d);
        doc_printf(cols[0], " %-7.7s: %s (%+d To Hit)\n",
                    "Profic",
                    skills_shield_describe_current(o_ptr->sval),
                    skills_shield_calc_bonus(o_ptr->sval));
    }
    else
    {
        doc_printf(cols[0], " %-7.7s: %s (%+d To Hit)\n",
                    "Profic",
                    skills_weapon_describe_current(o_ptr->tval, o_ptr->sval),
                    skills_weapon_calc_bonus(o_ptr->tval, o_ptr->sval));
    }
    doc_printf(cols[0], " %-7.7s: %d + %d = %d\n", "To Hit", to_h, p_ptr->weapon_info[hand].to_h, to_h + p_ptr->weapon_info[hand].to_h);
    doc_printf(cols[0], " %-7.7s: %d + %d = %d\n", "To Dam", to_d, p_ptr->weapon_info[hand].to_d, to_d + p_ptr->weapon_info[hand].to_d);
    doc_printf(cols[0], " %-7.7s: %d.%2.2d\n", "Blows", num_blow/100, num_blow%100);

    if (p_ptr->weapon_info[hand].dual_wield_pct < 1000)
    {
        doc_printf(cols[0], " %-7.7s: %d.%d%%\n", "Skill",
            p_ptr->weapon_info[hand].dual_wield_pct/ 10,
            p_ptr->weapon_info[hand].dual_wield_pct % 10);
    }

    mult = mult * crit.mul / 100;
    to_d = to_d + crit.to_d/100 + p_ptr->weapon_info[hand].to_d;

    doc_printf(cols[0], "<color:G> %-7.7s</color>\n", "Damage");

    if (!have_flag(flgs, TR_ORDER))
    {
        if (crit.to_d)
        {
            doc_printf(cols[0], " %-7.7s: %d.%02dx + %d.%02d\n", "Crits",
                            crit.mul/100, crit.mul%100, crit.to_d/100, crit.to_d%100);
        }
        else
        {
            doc_printf(cols[0], " %-7.7s: %d.%02dx (%d.%d%%)\n", "Crits",
                            crit.mul/100, crit.mul%100, crit_pct / 10, crit_pct % 10);
        }
    }
    if (p_ptr->weapon_info[hand].to_mult)
    {
        int m = 100 + p_ptr->weapon_info[hand].to_mult;
        doc_printf(cols[0], " %-7.7s: %d.%02dx\n", "Mauler", m / 100, m % 100);
    }


    _display_weapon_slay(mult, 100, FALSE, num_blow, dd, ds, to_d, "Normal", TERM_WHITE, cols[0]);
    if (force)
        _display_weapon_slay(mult, 100, force, num_blow, dd, ds, to_d, "Force", TERM_L_BLUE, cols[0]);

    if (p_ptr->tim_slay_sentient)
        _display_weapon_slay(mult, 200, force, num_blow, dd, ds, to_d, "Sent.", TERM_YELLOW, cols[0]);
    
    if (have_flag(flgs, TR_KILL_ANIMAL)) 
        _display_weapon_slay(mult, 400, force, num_blow, dd, ds, to_d, "Animals", TERM_YELLOW, cols[0]);
    else if (have_flag(flgs, TR_SLAY_ANIMAL))
        _display_weapon_slay(mult, 250, force, num_blow, dd, ds, to_d, "Animals", TERM_YELLOW, cols[0]);
    
    if (have_flag(flgs, TR_KILL_EVIL))   
        _display_weapon_slay(mult, 350, force, num_blow, dd, ds, to_d, "Evil", TERM_YELLOW, cols[0]);
    else if (have_flag(flgs, TR_SLAY_EVIL))
        _display_weapon_slay(mult, 200, force, num_blow, dd, ds, to_d, "Evil", TERM_YELLOW, cols[0]);

    if (have_flag(flgs, TR_SLAY_GOOD))
        _display_weapon_slay(mult, 200, force, num_blow, dd, ds, to_d, "Good", TERM_YELLOW, cols[0]);

    if (have_flag(flgs, TR_SLAY_LIVING))
        _display_weapon_slay(mult, 200, force, num_blow, dd, ds, to_d, "Living", TERM_YELLOW, cols[0]);

    if (have_flag(flgs, TR_KILL_HUMAN))
        _display_weapon_slay(mult, 400, force, num_blow, dd, ds, to_d, "Human", TERM_YELLOW, cols[0]);
    else if (have_flag(flgs, TR_SLAY_HUMAN))
        _display_weapon_slay(mult, 250, force, num_blow, dd, ds, to_d, "Human", TERM_YELLOW, cols[0]);

    if (have_flag(flgs, TR_KILL_UNDEAD))
        _display_weapon_slay(mult, 500, force, num_blow, dd, ds, to_d, "Undead", TERM_YELLOW, cols[0]);
    else if (have_flag(flgs, TR_SLAY_UNDEAD))
        _display_weapon_slay(mult, 300, force, num_blow, dd, ds, to_d, "Undead", TERM_YELLOW, cols[0]);
    
    if (have_flag(flgs, TR_KILL_DEMON))  
        _display_weapon_slay(mult, 500, force, num_blow, dd, ds, to_d, "Demons", TERM_YELLOW, cols[0]);
    else if (have_flag(flgs, TR_SLAY_DEMON))
        _display_weapon_slay(mult, 300, force, num_blow, dd, ds, to_d, "Demons", TERM_YELLOW, cols[0]);

    if (have_flag(flgs, TR_KILL_ORC))  
        _display_weapon_slay(mult, 500, force, num_blow, dd, ds, to_d, "Orcs", TERM_YELLOW, cols[0]);
    else if (have_flag(flgs, TR_SLAY_ORC))
        _display_weapon_slay(mult, 300, force, num_blow, dd, ds, to_d, "Orcs", TERM_YELLOW, cols[0]);

    if (have_flag(flgs, TR_KILL_TROLL))  
        _display_weapon_slay(mult, 500, force, num_blow, dd, ds, to_d, "Trolls", TERM_YELLOW, cols[0]);
    else if (have_flag(flgs, TR_SLAY_TROLL))
        _display_weapon_slay(mult, 300, force, num_blow, dd, ds, to_d, "Trolls", TERM_YELLOW, cols[0]);

    if (have_flag(flgs, TR_KILL_GIANT))  
        _display_weapon_slay(mult, 500, force, num_blow, dd, ds, to_d, "Giants", TERM_YELLOW, cols[0]);
    else if (have_flag(flgs, TR_SLAY_GIANT))
        _display_weapon_slay(mult, 300, force, num_blow, dd, ds, to_d, "Giants", TERM_YELLOW, cols[0]);

    if (have_flag(flgs, TR_KILL_DRAGON))  
        _display_weapon_slay(mult, 500, force, num_blow, dd, ds, to_d, "Dragons", TERM_YELLOW, cols[0]);
    else if (have_flag(flgs, TR_SLAY_DRAGON))
        _display_weapon_slay(mult, 300, force, num_blow, dd, ds, to_d, "Dragons", TERM_YELLOW, cols[0]);
    
    if (have_flag(flgs, TR_BRAND_ACID))
        _display_weapon_slay(mult, 250, force, num_blow, dd, ds, to_d, "Acid", TERM_RED, cols[0]);

    if (have_flag(flgs, TR_BRAND_ELEC))
        _display_weapon_slay(mult, 250, force, num_blow, dd, ds, to_d, "Elec", TERM_RED, cols[0]);

    if (have_flag(flgs, TR_BRAND_FIRE))
        _display_weapon_slay(mult, 250, force, num_blow, dd, ds, to_d, "Fire", TERM_RED, cols[0]);

    if (have_flag(flgs, TR_BRAND_COLD))
        _display_weapon_slay(mult, 250, force, num_blow, dd, ds, to_d, "Cold", TERM_RED, cols[0]);

    if (have_flag(flgs, TR_BRAND_POIS))
        _display_weapon_slay(mult, 250, force, num_blow, dd, ds, to_d, "Poison", TERM_RED, cols[0]);

    if (p_ptr->weapon_info[hand].wield_how == WIELD_TWO_HANDS)
    {
        if (p_ptr->weapon_info[hand].omoi)
            doc_insert(cols[0], " Your weapon requires two hands to wield properly.\n");
    }

    if (p_ptr->weapon_info[hand].info)
    {
        byte a = p_ptr->weapon_info[hand].info_attr;
        if (!a) a = TERM_WHITE; /* uninitialized is TERM_DARK???! */
        doc_printf(cols[0], " <color:%c>%s</color>\n", attr_to_attr_char(a), p_ptr->weapon_info[hand].info);
    }

    /* Column #1 */
    doc_insert(cols[1], "<color:G>Accuracy</color>\n");
    doc_insert(cols[1], " AC Hit\n");

    doc_printf(cols[1], "%3d %2d%%\n", 25, hit_chance(hand, to_h, 25));
    doc_printf(cols[1], "%3d %2d%%\n", 50, hit_chance(hand, to_h, 50));
    doc_printf(cols[1], "%3d %2d%%\n", 75, hit_chance(hand, to_h, 75));
    doc_printf(cols[1], "%3d %2d%%\n", 100, hit_chance(hand, to_h, 100));
    doc_printf(cols[1], "%3d %2d%%\n", 125, hit_chance(hand, to_h, 125));
    doc_printf(cols[1], "%3d %2d%%\n", 150, hit_chance(hand, to_h, 150));
    doc_printf(cols[1], "%3d %2d%%\n", 175, hit_chance(hand, to_h, 175));
    doc_printf(cols[1], "%3d %2d%%\n", 200, hit_chance(hand, to_h, 200));

    /* Assemble the result */
    doc_insert_cols(doc, cols, 2, 1);
    doc_free(cols[0]);
    doc_free(cols[1]);
}
Exemplo n.º 11
0
static object_type *_weapon(void)
{
    return equip_obj(p_ptr->weapon_info[0].slot);
}
Exemplo n.º 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;
}
Exemplo n.º 13
0
static void learned_info(char *p, int power)
{
    int plev = pseudo_plev();
    int hp = p_ptr->chp;

    cptr s_dam = "dam ";
    cptr s_dur = "dur ";
    cptr s_range = "range ";
    cptr s_heal = "heal ";

    strcpy(p, "");

    switch (power)
    {
        case MS_SHRIEK:
        case MS_XXX1:
        case MS_XXX2:
        case MS_XXX3:
        case MS_SCARE:
        case MS_BLIND:
        case MS_CONF:
        case MS_SLOW:
        case MS_SLEEP:
        case MS_HAND_DOOM:
        case MS_WORLD:
        case MS_SPECIAL:
        case MS_TELE_TO:
        case MS_TELE_AWAY:
        case MS_TELE_LEVEL:
        case MS_DARKNESS:
        case MS_MAKE_TRAP:
        case MS_FORGET:
        case MS_S_KIN:
        case MS_S_CYBER:
        case MS_S_MONSTER:
        case MS_S_MONSTERS:
        case MS_S_ANT:
        case MS_S_SPIDER:
        case MS_S_HOUND:
        case MS_S_HYDRA:
        case MS_S_ANGEL:
        case MS_S_DEMON:
        case MS_S_UNDEAD:
        case MS_S_DRAGON:
        case MS_S_HI_UNDEAD:
        case MS_S_HI_DRAGON:
        case MS_S_AMBERITE:
        case MS_S_UNIQUE:
            break;
        case MS_BALL_MANA:
        case MS_BALL_DARK:
        case MS_STARBURST:
            sprintf(p, " %s%d+10d%d", s_dam, spell_power(plev * 8 + 50), spell_power(10));
            break;
        case MS_DISPEL:
            break;
        case MS_ROCKET:
            sprintf(p, " %s%d", s_dam, spell_power(hp/4));
            break;
        case MS_SHOOT:
        {
            int slot = equip_find_first(object_is_melee_weapon);
            if (slot)
            {
                object_type *o_ptr = equip_obj(slot);
                sprintf(p, " %s%dd%d+%d", s_dam, o_ptr->dd, spell_power(o_ptr->ds), spell_power(o_ptr->to_d));
            }
            else
                sprintf(p, " %s1", s_dam);
            break;
        }
        case MS_BR_STORM:
        case MS_BR_ACID:
        case MS_BR_ELEC:
        case MS_BR_FIRE:
        case MS_BR_COLD:
        case MS_BR_POIS:
        case MS_BR_NUKE:
            sprintf(p, " %s%d", s_dam, spell_power(hp/3));
            break;
        case MS_BR_NEXUS:
            sprintf(p, " %s%d", s_dam, spell_power(MIN(hp/3, 250)));
            break;
        case MS_BR_TIME:
            sprintf(p, " %s%d", s_dam, spell_power(MIN(hp/3, 150)));
            break;
        case MS_BR_GRAVITY:
            sprintf(p, " %s%d", s_dam, spell_power(MIN(hp/3, 200)));
            break;
        case MS_BR_MANA:
            sprintf(p, " %s%d", s_dam, spell_power(MIN(hp/3, 250)));
            break;
        case MS_BR_NETHER:
        case MS_BR_LITE:
        case MS_BR_DARK:
        case MS_BR_CONF:
        case MS_BR_SOUND:
        case MS_BR_CHAOS:
        case MS_BR_DISEN:
        case MS_BR_SHARDS:
        case MS_BR_PLASMA:
            sprintf(p, " %s%d", s_dam, spell_power(hp/6));
            break;
        case MS_BR_INERTIA:
        case MS_BR_FORCE:
            sprintf(p, " %s%d", s_dam, spell_power(MIN(hp/6, 200)));
            break;
        case MS_BR_DISI:
            sprintf(p, " %s%d", s_dam, spell_power(MIN(hp/6, 150)));
            break;
        case MS_BALL_NUKE:
            sprintf(p, " %s%d+10d%d", s_dam, spell_power(plev * 2), spell_power(6));
            break;
        case MS_BALL_CHAOS:
            sprintf(p, " %s%d+10d%d", s_dam, spell_power(plev * 4), spell_power(10));
            break;
        case MS_BALL_ACID:
            sprintf(p, " %s%d+d%d", s_dam, spell_power(15), spell_power(plev * 6));
            break;
        case MS_BALL_ELEC:
            sprintf(p, " %s%d+d%d", s_dam, spell_power(8), spell_power(plev * 3));
            break;
        case MS_BALL_FIRE:
            sprintf(p, " %s%d+d%d", s_dam, spell_power(10), spell_power(plev * 7));
            break;
        case MS_BALL_COLD:
            sprintf(p, " %s%d+d%d", s_dam, spell_power(10), spell_power(plev * 3));
            break;
        case MS_BALL_POIS:
            sprintf(p, " %s%dd2", s_dam,spell_power(12));
            break;
        case MS_BALL_NETHER:
            sprintf(p, " %s%d+10d%d", s_dam, spell_power(plev * 2 + 50), spell_power(10));
            break;
        case MS_BALL_WATER:
            sprintf(p, " %s%d+d%d", s_dam, spell_power(50), spell_power(plev * 4));
            break;
        case MS_DRAIN_MANA:
            sprintf(p, " %sd%d+%d", s_heal, spell_power(plev), spell_power(plev));
            break;
        case MS_MIND_BLAST:
            sprintf(p, " %s8d%d", s_dam, spell_power(8));
            break;
        case MS_BRAIN_SMASH:
            sprintf(p, " %s12d%d", s_dam, spell_power(15));
            break;
        case MS_CAUSE_1:
            sprintf(p, " %s3d%d", s_dam, spell_power(8));
            break;
        case MS_CAUSE_2:
            sprintf(p, " %s8d%d", s_dam, spell_power(8));
            break;
        case MS_CAUSE_3:
            sprintf(p, " %s10d%d", s_dam, spell_power(15));
            break;
        case MS_CAUSE_4:
            sprintf(p, " %s15d%d", s_dam, spell_power(15));
            break;
        case MS_BOLT_ACID:
            sprintf(p, " %s%d+7d%d", s_dam, spell_power(plev * 2 / 3), spell_power(8));
            break;
        case MS_BOLT_ELEC:
            sprintf(p, " %s%d+4d%d", s_dam, spell_power(plev * 2 / 3), spell_power(8));
            break;
        case MS_BOLT_FIRE:
            sprintf(p, " %s%d+9d%d", s_dam, spell_power(plev * 2 / 3), spell_power(8));
            break;
        case MS_BOLT_COLD:
            sprintf(p, " %s%d+6d%d", s_dam, spell_power(plev * 2 / 3), spell_power(8));
            break;
        case MS_BOLT_NETHER:
            sprintf(p, " %s%d+5d%d", s_dam, spell_power(30 + plev * 8 / 3), spell_power(5));
            break;
        case MS_BOLT_WATER:
            sprintf(p, " %s%d+10d%d", s_dam, spell_power(plev * 2), spell_power(10));
            break;
        case MS_BOLT_MANA:
            sprintf(p, " %s%d+d%d", s_dam, spell_power(50), spell_power(plev * 7));
            break;
        case MS_BOLT_PLASMA:
            sprintf(p, " %s%d+8d%d", s_dam, spell_power(plev * 2 + 10), spell_power(7));
            break;
        case MS_BOLT_ICE:
            sprintf(p, " %s%d+6d%d", s_dam, spell_power(plev * 2), spell_power(6));
            break;
        case MS_MAGIC_MISSILE:
            sprintf(p, " %s%d+2d%d", s_dam, spell_power(plev * 2 / 3), spell_power(6));
            break;
        case MS_SPEED:
            sprintf(p, " %sd%d+%d", s_dur, 20+plev, plev);
            break;
        case MS_HEAL:
            sprintf(p, " %s%d", s_heal, spell_power(plev*4));
            break;
        case MS_INVULNER:
            sprintf(p, " %sd%d+%d", s_dur, spell_power(4), spell_power(4));
            break;
        case MS_BLINK:
            sprintf(p, " %s10", s_range);
            break;
        case MS_TELEPORT:
            sprintf(p, " %s%d", s_range, plev * 5);
            break;
        case MS_PSY_SPEAR:
            sprintf(p, " %s%d+d%d", s_dam, spell_power(100), spell_power(plev * 3));
            break;
        case MS_RAISE_DEAD:
            sprintf(p, " %s5", s_range);
            break;
        default:
            break;
    }
}