Exemplo n.º 1
0
/**
 * Notice random effect curses
 */
void notice_curse(int curse_flag, int item)
{
    object_type *o_ptr;
    int i;
    bool already_ego = FALSE;

    if (item) {
	if (item > 0)
	    o_ptr = &p_ptr->inventory[item - 1];
	else
	    o_ptr = &o_list[0 - item];

	already_ego = has_ego_properties(o_ptr);

	if (cf_has(o_ptr->flags_curse, curse_flag)) {
	    cf_on(o_ptr->id_curse, curse_flag);
	    o_ptr->ident |= IDENT_CURSED;

	    /* Ego item? */
	    if (already_ego != has_ego_properties(o_ptr))
		label_as_ego(o_ptr, item);
	}
	/* Fully identified now? */
	if (known_really(o_ptr))
	    identify_object(o_ptr);

	return;
    }

    for (i = INVEN_WIELD; i <= INVEN_FEET; i++) {
	o_ptr = &p_ptr->inventory[i];

	already_ego = has_ego_properties(o_ptr);

	/* Look for curses */
	if (cf_has(o_ptr->flags_curse, curse_flag)) {
	    /* Found one */
	    cf_on(o_ptr->id_curse, curse_flag);
	    o_ptr->ident |= IDENT_CURSED;

	    /* Ego item? */
	    if (already_ego != has_ego_properties(o_ptr))
		label_as_ego(o_ptr, item);
	}

	/* Fully identified now? */
	if (known_really(o_ptr))
	    identify_object(o_ptr);
    }
}
Exemplo n.º 2
0
/**
 * Notice object flags
 */
void notice_obj(int obj_flag, int item)
{
    object_type *o_ptr;
    int i;
    bool already_ego = FALSE;

    if (item) {
	if (item > 0)
	    o_ptr = &p_ptr->inventory[item - 1];
	else
	    o_ptr = &o_list[0 - item];

	already_ego = has_ego_properties(o_ptr);

	/* Add properties */
	if (of_has(o_ptr->flags_obj, obj_flag)) 
	    of_on(o_ptr->id_obj, obj_flag);

	/* Ego item? */
	if (already_ego != has_ego_properties(o_ptr))
	    label_as_ego(o_ptr, item);

	/* Fully identified now? */
	if (known_really(o_ptr))
	    identify_object(o_ptr);

	return;
    }

    for (i = INVEN_WIELD; i <= INVEN_FEET; i++) {
	o_ptr = &p_ptr->inventory[i];

	already_ego = has_ego_properties(o_ptr);

	/* Add properties */
	if (of_has(o_ptr->flags_obj, obj_flag)) 
	    of_on(o_ptr->id_obj, obj_flag);
	
	/* Ego item? */
	if (already_ego != has_ego_properties(o_ptr))
	    label_as_ego(o_ptr, item);

	/* Fully identified now? */
	if (known_really(o_ptr))
	    identify_object(o_ptr);
    }
}
Exemplo n.º 3
0
/**
 * Notice other properties
 */
void notice_other(int other_flag, int item)
{
    int i, j;
    bool already_ego = FALSE;
    object_type *o_ptr;

    if (item) {
	if (item > 0)
	    o_ptr = &p_ptr->inventory[item - 1];
	else
	    o_ptr = &o_list[0 - item];
	
	already_ego = has_ego_properties(o_ptr);
	
	/* Resists */
	for (j = 0; j < MAX_P_RES; j++) {
	    if (other_flag != OBJECT_ID_BASE_RESIST + j) continue;
	    if (o_ptr->percent_res[j] != RES_LEVEL_BASE) {
		if_on(o_ptr->id_other, other_flag);
	    }
	}
	
	/* Slays */
	for (j = 0; j < MAX_P_SLAY; j++) {
	    if (other_flag != OBJECT_ID_BASE_SLAY + j) continue;
	    if (o_ptr->multiple_slay[j] != MULTIPLE_BASE) {
		if_on(o_ptr->id_other, other_flag);
	    }
	}


	/* Brands */
	for (j = 0; j < MAX_P_BRAND; j++) {
	    if (other_flag != OBJECT_ID_BASE_BRAND + j) continue;
	    if (o_ptr->multiple_brand[j] != MULTIPLE_BASE) {
		if_on(o_ptr->id_other, other_flag);
	    }
	}
	
	/* Others */
	if ((other_flag == IF_TO_H) && ((o_ptr->to_h) || is_weapon(o_ptr)))
	    if_on(o_ptr->id_other, IF_TO_H);
	if ((other_flag == IF_TO_D) && ((o_ptr->to_d) || is_weapon(o_ptr)))
	    if_on(o_ptr->id_other, IF_TO_D);
	if ((other_flag == IF_TO_A) && ((o_ptr->ac) || is_armour(o_ptr)))
	    if_on(o_ptr->id_other, IF_TO_A);
	if ((other_flag == IF_AC) && ((o_ptr->ac) || is_armour(o_ptr)))
	    if_on(o_ptr->id_other, IF_AC);
	if ((other_flag == IF_DD_DS))
	    if_on(o_ptr->id_other, IF_DD_DS);
	
	/* Ego item? */
	if (already_ego != has_ego_properties(o_ptr))
	    label_as_ego(o_ptr, item);
	
	/* Fully identified now? */
	if (known_really(o_ptr))
	    identify_object(o_ptr);
	
	return;
    }
    
    for (i = INVEN_WIELD; i <= INVEN_FEET; i++) {
	o_ptr = &p_ptr->inventory[i];
	
	already_ego = has_ego_properties(o_ptr);
	
	/* Resists */
	for (j = 0; j < MAX_P_RES; j++) {
	    if (other_flag != OBJECT_ID_BASE_RESIST + j) continue;
	    if (o_ptr->percent_res[j] != RES_LEVEL_BASE) {
		if_on(o_ptr->id_other, other_flag);
		if ((j == INVEN_RIGHT) || (j == INVEN_LEFT)
		    || (j == INVEN_NECK)) {
		    if_on(o_ptr->id_other, other_flag);
		}
	    }
	}

	/* Slays */
	for (j = 0; j < MAX_P_SLAY; j++) {
	    if (other_flag != OBJECT_ID_BASE_SLAY + j) continue;
	    if (o_ptr->multiple_slay[j] != MULTIPLE_BASE) {
		if_on(o_ptr->id_other, other_flag);
		if ((j == INVEN_RIGHT) || (j == INVEN_LEFT)
		    || (j == INVEN_NECK)) {
		    if_on(o_ptr->id_other, other_flag);
		}
	    }
	}
	
	/* Brands */
	for (j = 0; j < MAX_P_BRAND; j++) {
	    if (other_flag != OBJECT_ID_BASE_BRAND + j) continue;
	    if (o_ptr->multiple_brand[j] != MULTIPLE_BASE) {
		if_on(o_ptr->id_other, other_flag);
		if ((j == INVEN_RIGHT) || (j == INVEN_LEFT)
		    || (j == INVEN_NECK)) {
		    if_on(o_ptr->id_other, other_flag);
		}
	    }
	}

	/* Others */
	if ((other_flag == IF_TO_H) && ((o_ptr->to_h) || is_weapon(o_ptr)))
	    if_on(o_ptr->id_other, IF_TO_H);
	if ((other_flag == IF_TO_D) && ((o_ptr->to_d) || is_weapon(o_ptr)))
	    if_on(o_ptr->id_other, IF_TO_D);
	if ((other_flag == IF_TO_A) && ((o_ptr->ac) || is_armour(o_ptr)))
	    if_on(o_ptr->id_other, IF_TO_A);
	if ((other_flag == IF_AC) && ((o_ptr->ac) || is_armour(o_ptr)))
	    if_on(o_ptr->id_other, IF_AC);
	if ((other_flag == IF_DD_DS))
	    if_on(o_ptr->id_other, IF_DD_DS);

	/* Ego item? */
	if (already_ego != has_ego_properties(o_ptr))
	    label_as_ego(o_ptr, item);

	/* Fully identified now? */
	if (known_really(o_ptr))
	    identify_object(o_ptr);
    }
}
Exemplo n.º 4
0
/**
 * Carry an object and delete it.
 */
extern void py_pickup_aux(int o_idx, bool msg)
{
    int slot, quiver_slot = 0;

    char o_name[120];
    object_type *o_ptr = &o_list[o_idx];
    object_type *i_ptr = &p_ptr->inventory[INVEN_LIGHT];
    bitflag f[OF_SIZE], obvious_mask[OF_SIZE];


    flags_init(obvious_mask, OF_SIZE, OF_OBVIOUS_MASK, FLAG_END);
    of_copy(f, o_ptr->flags_obj);
    
    /* Carry the object */
    slot = inven_carry(p_ptr, o_ptr);

    /* Handle errors (paranoia) */
    if (slot < 0) return;

    /* If we have picked up ammo which matches something in the quiver, note
     * that it so that we can wield it later (and suppress pick up message) */
    if (obj_is_quiver_obj(o_ptr)) 
    {
	int i;
	for (i = QUIVER_START; i < QUIVER_END; i++) 
	{
	    if (!p_ptr->inventory[i].k_idx) continue;
	    if (!object_similar(&p_ptr->inventory[i], o_ptr,
				OSTACK_QUIVER)) continue;
	    quiver_slot = i;
	    break;
	}
    }

    /* Get the object again */
    o_ptr = &p_ptr->inventory[slot];

    /* Set squelch status */
    p_ptr->notice |= PN_SQUELCH;

    /* Stone of Lore gives id on pickup */
    if (!object_known_p(o_ptr)) {
	if (i_ptr->sval == SV_STONE_LORE)
	    identify_object(o_ptr);

	/* Otherwise pseudo-ID */
	else {
	    bool heavy = FALSE;
	    int feel;

	    /* Heavy sensing */
	    heavy = (player_has(PF_PSEUDO_ID_HEAVY));

	    /* Type of feeling */
	    feel = (heavy ? value_check_aux1(o_ptr) : value_check_aux2(o_ptr));

	    /* We have "felt" it */
	    o_ptr->ident |= (IDENT_SENSE);

	    /* Inscribe it textually */
	    o_ptr->feel = feel;

	    /* Set squelch flag as appropriate */
	    p_ptr->notice |= PN_SQUELCH;
	}
    }

    /* Log artifacts if found */
    if (artifact_p(o_ptr))
	history_add_artifact(o_ptr->name1, object_is_known(o_ptr), TRUE);

    /* Notice dice and other obvious stuff */
    notice_other(IF_DD_DS, slot + 1);
    (void) of_inter(f, obvious_mask);
    of_union(o_ptr->id_obj, f);

    /* Average things are average */
    if ((o_ptr->feel == FEEL_AVERAGE) && (is_weapon(o_ptr) || is_armour(o_ptr))){
	notice_other(IF_AC, slot + 1);
	notice_other(IF_TO_A, slot + 1);
	notice_other(IF_TO_H, slot + 1);
	notice_other(IF_TO_D, slot + 1);
    }

    /* Recalculate the bonuses */
    p_ptr->update |= (PU_BONUS);

    /* Optionally, display a message */
    if (msg && !quiver_slot)
    {
	/* Describe the object */
	object_desc(o_name, sizeof(o_name), o_ptr, ODESC_PREFIX | ODESC_FULL);

	/* Message */
	msg_format("You have %s (%c).", o_name, index_to_label(slot));
    }


    /* Delete the object */
    delete_object_idx(o_idx);

    /* If we have a quiver slot that this item matches, use it */
    if (quiver_slot) wield_item(o_ptr, slot, quiver_slot);
}
Exemplo n.º 5
0
void WizardModeDialog::wiz_winners_kit(void)
{
    if (!character_dungeon) return;

    if (game_mode == GAME_NPPMORIA)
    {
        // Make 2 rings of speed
        int k_idx = lookup_kind(TV_RING, SV_RING_SPEED);
        object_type object_type_body;
        object_type *i_ptr = &object_type_body;
        i_ptr->object_wipe();
        if (k_idx)
        {
            object_prep(i_ptr, k_idx);
            apply_magic(i_ptr, k_info[k_idx].k_level, FALSE, TRUE, TRUE, TRUE);
            i_ptr->number = 2;
            i_ptr->mark_fully_known(TRUE);
            object_history(i_ptr, ORIGIN_CHEAT, 0);
            if(inven_carry(i_ptr) < 0)
            {
                drop_near(i_ptr, -1, p_ptr->py, p_ptr->px);
            }
        }
        //Give an amulet of the magi;
        k_idx = lookup_kind(TV_AMULET, SV_AMULET_THE_MAGI);
        if (k_idx)
        {
            i_ptr->object_wipe();
            object_prep(i_ptr, k_idx);
            apply_magic(i_ptr, k_info[k_idx].k_level, FALSE, TRUE, TRUE, TRUE);
            i_ptr->mark_fully_known(TRUE);
            object_history(i_ptr, ORIGIN_CHEAT, 0);
            if(inven_carry(i_ptr) < 0)
            {
                drop_near(i_ptr, -1, p_ptr->py, p_ptr->px);
            }
        }
        //boots of speed
        k_idx = lookup_kind(TV_BOOTS, SV_PAIR_OF_SOFT_LEATHER_BOOTS);
        int ego_num = lookup_ego(TV_BOOTS, SV_PAIR_OF_SOFT_LEATHER_BOOTS, "speed");
        if (k_idx && ego_num)
        {
            i_ptr->object_wipe();
            object_prep(i_ptr, k_idx);
            i_ptr->ego_num = ego_num;
            a_m_aux_2(i_ptr, k_info[k_idx].k_level, 2);
            apply_ego_item_magic(i_ptr, k_info[k_idx].k_level);
            i_ptr->to_a = 25;
            i_ptr->mark_fully_known(TRUE);
            object_history(i_ptr, ORIGIN_CHEAT, 0);
            if(inven_carry(i_ptr) < 0)
            {
                drop_near(i_ptr, -1, p_ptr->py, p_ptr->px);
            }
        }
        // Robe of Resistance
        k_idx = lookup_kind(TV_SOFT_ARMOR, SV_ROBE);
        ego_num = lookup_ego(TV_SOFT_ARMOR, SV_ROBE, "resistance");
        if (k_idx && ego_num)
        {
            i_ptr->object_wipe();
            object_prep(i_ptr, k_idx);
            i_ptr->ego_num = ego_num;
            a_m_aux_2(i_ptr, k_info[k_idx].k_level, 2);
            apply_ego_item_magic(i_ptr, k_info[k_idx].k_level);
            i_ptr->to_a = 25;
            i_ptr->mark_fully_known(TRUE);
            object_history(i_ptr, ORIGIN_CHEAT, 0);
            if(inven_carry(i_ptr) < 0)
            {
                drop_near(i_ptr, -1, p_ptr->py, p_ptr->px);
            }
        }
        // super-charged holy avenger dagger
        k_idx = lookup_kind(TV_SWORD, SV_DAGGER);
        ego_num = lookup_ego(TV_SWORD, SV_DAGGER, "holy avenger");
        if (k_idx && ego_num)
        {
            i_ptr->object_wipe();
            object_prep(i_ptr, k_idx);
            i_ptr->ego_num = ego_num;
            a_m_aux_1(i_ptr, k_info[k_idx].k_level, 2);
            apply_ego_item_magic(i_ptr, k_info[k_idx].k_level);
            i_ptr->to_a = i_ptr->to_h = i_ptr->to_d = 25;
            i_ptr->dd = i_ptr->ds = 9;
            i_ptr->mark_fully_known(TRUE);
            object_history(i_ptr, ORIGIN_CHEAT, 0);
            if(inven_carry(i_ptr) < 0)
            {
                drop_near(i_ptr, -1, p_ptr->py, p_ptr->px);
            }
        }
        // crown of the magi
        k_idx = lookup_kind(TV_CROWN, SV_SILVER_CROWN);
        ego_num = lookup_ego(TV_CROWN, SV_SILVER_CROWN, "magi");
        if (k_idx && ego_num)
        {
            i_ptr->object_wipe();
            object_prep(i_ptr, k_idx);
            i_ptr->ego_num = ego_num;
            a_m_aux_2(i_ptr, k_info[k_idx].k_level, 2);
            apply_ego_item_magic(i_ptr, k_info[k_idx].k_level);
            i_ptr->to_a = 25;
            i_ptr->mark_fully_known(TRUE);
            object_history(i_ptr, ORIGIN_CHEAT, 0);
            if(inven_carry(i_ptr) < 0)
            {
                drop_near(i_ptr, -1, p_ptr->py, p_ptr->px);
            }
        }
        // super charged gloves of slaying
        k_idx = lookup_kind(TV_GLOVES, SV_SET_OF_LEATHER_GLOVES);
        ego_num = lookup_ego(TV_GLOVES, SV_SET_OF_LEATHER_GLOVES, "slaying");
        if (k_idx && ego_num)
        {
            i_ptr->object_wipe();
            object_prep(i_ptr, k_idx);
            i_ptr->ego_num = ego_num;
            a_m_aux_2(i_ptr, k_info[k_idx].k_level, 2);
            apply_ego_item_magic(i_ptr, k_info[k_idx].k_level);
            i_ptr->to_a = i_ptr->to_h = i_ptr->to_d = 25;
            i_ptr->mark_fully_known(TRUE);
            object_history(i_ptr, ORIGIN_CHEAT, 0);
            if(inven_carry(i_ptr) < 0)
            {
                drop_near(i_ptr, -1, p_ptr->py, p_ptr->px);
            }
        }
        //finally the Phial
        if (TRUE)
        {
            i_ptr->object_wipe();
            if (wiz_alloc_artifact(i_ptr, 1))
            {
                object_history(i_ptr, ORIGIN_CHEAT, 0);
                identify_object(i_ptr, true);
                if(inven_carry(i_ptr) < 0)
                {
                    drop_near(i_ptr, -1, p_ptr->py, p_ptr->px);
                }
            }
        }

        handle_stuff();
        this->accept();
        return;

    }

    else if (game_mode != GAME_NPPANGBAND) return;

    int artis[] = {
        47,     // RINGIL
        124,    // CUBRAGOL
        13,     // NARYA
        14,     // NENYA
        10,     // ELESSAR
        12,     // GEM OF AMON SUL
        38,     // BLADETUNDER
        113,    // COLANNON
        33,     // THORIN
        110,    // NUMENOR
        129,    // CAMBELEG
        127,    // FEANOR
        0
    };

    object_type obj;
    object_type *o_ptr = &obj;

    for (int i = 0; artis[i]; i++)
    {
        o_ptr->object_wipe();
        if (!wiz_alloc_artifact(o_ptr, artis[i])) continue;
        object_history(o_ptr, ORIGIN_CHEAT, 0);
        identify_object(o_ptr, true);
        if (inven_carry(o_ptr) < 0)
        {
            drop_near(o_ptr, -1, p_ptr->py, p_ptr->px);
        }
        QString name = object_desc(o_ptr, ODESC_PREFIX | ODESC_FULL);
        message("Allocated " + name);
    }

    //Some amazing ammo;
    int k_idx = lookup_kind(TV_BOLT, SV_AMMO_MITHRIL);
    int ego_num = lookup_ego(TV_BOLT, SV_AMMO_MITHRIL, "holy might");
    if (k_idx && ego_num)
    {
        o_ptr->object_wipe();
        object_prep(o_ptr, k_idx);
        o_ptr->ego_num = ego_num;
        a_m_aux_1(o_ptr, k_info[k_idx].k_level, 2);
        apply_ego_item_magic(o_ptr, k_info[k_idx].k_level);
        o_ptr->to_h = 99;
        o_ptr->to_d = 99;
        o_ptr->dd = 25;
        o_ptr->ds = 25;
        o_ptr->number = 99;
        o_ptr->mark_fully_known(TRUE);
        object_history(o_ptr, ORIGIN_CHEAT, 0);
        if(inven_carry(o_ptr) < 0)
        {
            drop_near(o_ptr, -1, p_ptr->py, p_ptr->px);
        }
    }

    handle_stuff();

    this->accept();
}
Exemplo n.º 6
0
// Select an artifact from a list and place it in the player's inventory.
// Note that dragon armor comes out doesn't work too well, since it
// is always make into an ego item.
MakeObjectDialog::MakeObjectDialog(void)
{
    int i;
    QPointer<QVBoxLayout> vlay = new QVBoxLayout;
    obj_choice = new QComboBox;
    object_type object_type_body;
    object_type *i_ptr = &object_type_body;


    QPointer<QLabel>  obj_label = new QLabel(QString("<b><big>Please select an object:</big></b>"));
    obj_label->setAlignment(Qt::AlignCenter);

    vlay->addWidget(obj_label);
    vlay->addStretch();

    connect(obj_choice, SIGNAL(currentIndexChanged(int)), this, SLOT(update_obj_choice(int)));

    QPointer<QPushButton> close_button = new QPushButton(tr("&Close"));
    connect(close_button, SIGNAL(clicked()), this, SLOT(close()));

    int count = 0;
    obj_num = 0;

    for (i = 1; i < z_info->k_max; i++)
    {
        object_kind *k_ptr = &k_info[i];

        /* Skip "empty" items */
        if (k_ptr->k_name.isEmpty()) continue;
        // Skip artifact templates
        if (k_ptr->k_flags3 & (TR3_INSTA_ART)) continue;
        // Skip gold
        if (k_ptr->tval == TV_GOLD) continue;

        obj_choice->addItem(QString("%1") .arg(i));

        obj_choice->setItemText(count++, get_object_display_name(i));
    }

    vlay->addWidget(obj_choice);
    vlay->addStretch();
    vlay->addWidget(close_button);

    setLayout(vlay);

    setWindowTitle(tr("Make Object"));
    this->exec();

    // find the object
    count = 0;
    for (i = 1; i < z_info->k_max; i++)
    {
        object_kind *k_ptr = &k_info[i];

        /* Skip "empty" items */
        if (k_ptr->k_name.isEmpty()) continue;
        // Skip artifact templates
        if (k_ptr->k_flags3 & (TR3_INSTA_ART)) continue;
        // Skip gold
        if (k_ptr->tval == TV_GOLD) continue;

        // Found the match
        if (count == obj_num) break;
        count++;
    }

    //  This is necessary to keep the game from freezing on dragon armor
    object_level = k_info[i].k_level;

    i_ptr->object_wipe();
    object_prep(i_ptr, i);
    apply_magic(i_ptr, p_ptr->depth, FALSE, FALSE, FALSE, FALSE);
    object_history(i_ptr, ORIGIN_CHEAT, 0);
    identify_object(i_ptr, true);
    if(inven_carry(i_ptr) < 0)
    {
        drop_near(i_ptr, -1, p_ptr->py, p_ptr->px);
    }

    object_level = p_ptr->depth;
}
Exemplo n.º 7
0
// Select an artifact from a list and place it in the player's inventory
MakeArtifactDialog::MakeArtifactDialog(void)
{
    int i;
    QPointer<QVBoxLayout> vlay = new QVBoxLayout;
    art_choice = new QComboBox;
    object_type object_type_body;
    object_type *i_ptr = &object_type_body;


    QPointer<QLabel>  obj_label = new QLabel(QString("<b><big>Please select an artifact:</big></b>"));
    obj_label->setAlignment(Qt::AlignCenter);

    vlay->addWidget(obj_label);
    vlay->addStretch();

    connect(art_choice, SIGNAL(currentIndexChanged(int)), this, SLOT(update_art_choice(int)));

    QPointer<QPushButton> close_button = new QPushButton(tr("&Close"));
    connect(close_button, SIGNAL(clicked()), this, SLOT(close()));

    int count = 0;
    art_num = 0;

    for (i = 1; i < z_info->art_norm_max; i++)
    {
        artifact_type *a_ptr = &a_info[i];

        /* Skip "empty" items */
        if (a_ptr->tval + a_ptr->sval == 0) continue;

        art_choice->addItem(QString("%1") .arg(i));

        art_choice->setItemText(count++, get_artifact_display_name(i));
    }

    vlay->addWidget(art_choice);
    vlay->addStretch();
    vlay->addWidget(close_button);

    setLayout(vlay);

    setWindowTitle(tr("Make Artifact"));
    this->exec();

    // find the artifact
    count = 0;
    for (i = 1; i < z_info->art_norm_max; i++)
    {
        artifact_type *a_ptr = &a_info[i];

        /* Skip "empty" items */
        if (a_ptr->tval + a_ptr->sval == 0) continue;

        // Found the match
        if (count == art_num) break;
        count++;
    }

    i_ptr->object_wipe();
    if (!wiz_alloc_artifact(i_ptr, i))
    {

     return;
    }
    object_history(i_ptr, ORIGIN_CHEAT, 0);
    identify_object(i_ptr, true);
    if(inven_carry(i_ptr) < 0)
    {
        drop_near(i_ptr, -1, p_ptr->py, p_ptr->px);
    }
}