}
if (have_flag(flgs, TR_AGGRAVATE)) total -= 10000;
if (have_flag(flgs, TR_BLESSED)) total += 750;
+ if (o_ptr->curse_flags & TR_ADD_L_CURSE) total -= 5000;
+ if (o_ptr->curse_flags & TR_ADD_H_CURSE) total -= 12500;
if (o_ptr->curse_flags & TRC_CURSED) total -= 5000;
if (o_ptr->curse_flags & TRC_HEAVY_CURSE) total -= 12500;
if (o_ptr->curse_flags & TRC_PERMA_CURSE) total -= 15000;
/* Also, give some extra for activatable powers... */
if (o_ptr->art_name && (have_flag(o_ptr->art_flags, TR_ACTIVATE)))
{
- int type = o_ptr->xtra2;
-
- if (type == ACT_SUNLIGHT) total += 250;
- else if (type == ACT_BO_MISS_1) total += 250;
- else if (type == ACT_BA_POIS_1) total += 300;
- else if (type == ACT_BO_ELEC_1) total += 250;
- else if (type == ACT_BO_ACID_1) total += 250;
- else if (type == ACT_BO_COLD_1) total += 250;
- else if (type == ACT_BO_FIRE_1) total += 250;
- else if (type == ACT_BA_COLD_1) total += 750;
- else if (type == ACT_BA_FIRE_1) total += 1000;
- else if (type == ACT_DRAIN_1) total += 500;
- else if (type == ACT_BA_COLD_2) total += 1250;
- else if (type == ACT_BA_ELEC_2) total += 1500;
- else if (type == ACT_DRAIN_2) total += 750;
- else if (type == ACT_VAMPIRE_1) total += 1000;
- else if (type == ACT_BO_MISS_2) total += 1000;
- else if (type == ACT_BA_FIRE_2) total += 1750;
- else if (type == ACT_BA_COLD_3) total += 2500;
- else if (type == ACT_BA_ELEC_3) total += 2500;
- else if (type == ACT_WHIRLWIND) total += 7500;
- else if (type == ACT_VAMPIRE_2) total += 2500;
- else if (type == ACT_CALL_CHAOS) total += 5000;
- else if (type == ACT_ROCKET) total += 5000;
- else if (type == ACT_DISP_EVIL) total += 4000;
- else if (type == ACT_DISP_GOOD) total += 3500;
- else if (type == ACT_BA_MISS_3) total += 5000;
- else if (type == ACT_CONFUSE) total += 500;
- else if (type == ACT_SLEEP) total += 750;
- else if (type == ACT_QUAKE) total += 600;
- else if (type == ACT_TERROR) total += 2500;
- else if (type == ACT_TELE_AWAY) total += 2000;
- else if (type == ACT_BANISH_EVIL) total += 2000;
- else if (type == ACT_GENOCIDE) total += 10000;
- else if (type == ACT_MASS_GENO) total += 10000;
- else if (type == ACT_CHARM_ANIMAL) total += 7500;
- else if (type == ACT_CHARM_UNDEAD) total += 10000;
- else if (type == ACT_CHARM_OTHER) total += 10000;
- else if (type == ACT_CHARM_ANIMALS) total += 12500;
- else if (type == ACT_CHARM_OTHERS) total += 17500;
- else if (type == ACT_SUMMON_ANIMAL) total += 10000;
- else if (type == ACT_SUMMON_PHANTOM) total += 12000;
- else if (type == ACT_SUMMON_ELEMENTAL) total += 15000;
- else if (type == ACT_SUMMON_DEMON) total += 20000;
- else if (type == ACT_SUMMON_UNDEAD) total += 20000;
- else if (type == ACT_CURE_LW) total += 500;
- else if (type == ACT_CURE_MW) total += 750;
- else if (type == ACT_CURE_POISON) total += 1000;
- else if (type == ACT_REST_LIFE) total += 7500;
- else if (type == ACT_REST_ALL) total += 15000;
- else if (type == ACT_CURE_700) total += 10000;
- else if (type == ACT_CURE_1000) total += 15000;
- else if (type == ACT_ESP) total += 1500;
- else if (type == ACT_BERSERK) total += 800;
- else if (type == ACT_PROT_EVIL) total += 5000;
- else if (type == ACT_RESIST_ALL) total += 5000;
- else if (type == ACT_SPEED) total += 15000;
- else if (type == ACT_XTRA_SPEED) total += 25000;
- else if (type == ACT_WRAITH) total += 25000;
- else if (type == ACT_INVULN) total += 25000;
- else if (type == ACT_LIGHT) total += 150;
- else if (type == ACT_MAP_LIGHT) total += 500;
- else if (type == ACT_DETECT_ALL) total += 1000;
- else if (type == ACT_DETECT_XTRA) total += 12500;
- else if (type == ACT_ID_FULL) total += 10000;
- else if (type == ACT_ID_PLAIN) total += 1250;
- else if (type == ACT_RUNE_EXPLO) total += 4000;
- else if (type == ACT_RUNE_PROT) total += 10000;
- else if (type == ACT_SATIATE) total += 2000;
- else if (type == ACT_DEST_DOOR) total += 100;
- else if (type == ACT_STONE_MUD) total += 1000;
- else if (type == ACT_RECHARGE) total += 1000;
- else if (type == ACT_ALCHEMY) total += 10000;
- else if (type == ACT_DIM_DOOR) total += 10000;
- else if (type == ACT_TELEPORT) total += 2000;
- else if (type == ACT_RECALL) total += 7500;
+ const activation_type* const act_ptr = find_activation_info(o_ptr);
+ if (act_ptr) {
+ total += act_ptr->value;
+ }
}
return total;
* Determine if an item can partly absorb a second item.
* Return maximum number of stack.
*/
-static int object_similar_part(object_type *o_ptr, object_type *j_ptr)
+int object_similar_part(object_type *o_ptr, object_type *j_ptr)
{
int i;
o_ptr->dd = k_ptr->dd;
o_ptr->ds = k_ptr->ds;
+ /* Default activation */
+ if (k_ptr->act_idx > 0) o_ptr->xtra2 = k_ptr->act_idx;
+
/* Hack -- worthless items are always "broken" */
if (k_info[o_ptr->k_idx].cost <= 0) o_ptr->ident |= (IDENT_BROKEN);
}
-#define MAX_ESP_WEAK 9
static void add_esp_weak(object_type *o_ptr, bool extra)
{
- int i = 0;
- int idx[MAX_ESP_WEAK];
- int flg[MAX_ESP_WEAK];
- int n = (extra) ? (3 + randint1(randint1(6))) : randint1(3);
- int left = MAX_ESP_WEAK;
-
- for (i = 0; i < MAX_ESP_WEAK; i++) flg[i] = i + 1;
+ int i;
+ u32b weak_esp_list[] = {
+ TR_ESP_ANIMAL,
+ TR_ESP_UNDEAD,
+ TR_ESP_DEMON,
+ TR_ESP_ORC,
+ TR_ESP_TROLL,
+ TR_ESP_GIANT,
+ TR_ESP_DRAGON,
+ TR_ESP_HUMAN,
+ TR_ESP_GOOD,
+ TR_ESP_UNIQUE,
+ };
+ const int MAX_ESP_WEAK = sizeof(weak_esp_list) / sizeof(weak_esp_list[0]);
+ const int add_count = MIN(MAX_ESP_WEAK, (extra) ? (3 + randint1(randint1(6))) : randint1(3));
- /* Shuffle esp flags */
- for (i = 0; i < n; i++)
+ /* Add unduplicated weak esp flags randomly */
+ for (i = 0; i < add_count; ++ i)
{
- int k = randint0(left--);
-
- idx[i] = flg[k];
-
- while (k < left)
- {
- flg[k] = flg[k + 1];
- k++;
- }
- }
+ int choice = rand_range(i, MAX_ESP_WEAK - 1);
- while (n--) switch (idx[n])
- {
- case 1: add_flag(o_ptr->art_flags, TR_ESP_ANIMAL); break;
- case 2: add_flag(o_ptr->art_flags, TR_ESP_UNDEAD); break;
- case 3: add_flag(o_ptr->art_flags, TR_ESP_DEMON); break;
- case 4: add_flag(o_ptr->art_flags, TR_ESP_ORC); break;
- case 5: add_flag(o_ptr->art_flags, TR_ESP_TROLL); break;
- case 6: add_flag(o_ptr->art_flags, TR_ESP_GIANT); break;
- case 7: add_flag(o_ptr->art_flags, TR_ESP_DRAGON); break;
- case 8: add_flag(o_ptr->art_flags, TR_ESP_HUMAN); break;
- case 9: add_flag(o_ptr->art_flags, TR_ESP_GOOD); break;
+ add_flag(o_ptr->art_flags, weak_esp_list[choice]);
+ weak_esp_list[choice] = weak_esp_list[i];
}
}
case EGO_WISDOM:
case EGO_BEAUTY:
case EGO_LITE:
+ case EGO_DARK:
case EGO_INFRAVISION:
break;
case EGO_SEEING:
o_ptr->to_h = a_ptr->to_h;
o_ptr->to_d = a_ptr->to_d;
o_ptr->weight = a_ptr->weight;
+ o_ptr->xtra2 = a_ptr->act_idx;
/* Hack -- extract the "broken" flag */
if (!a_ptr->cost) o_ptr->ident |= (IDENT_BROKEN);
}
/* Hack -- analyze ego-items */
- else if (object_is_ego(o_ptr))
+ if (object_is_ego(o_ptr))
{
ego_item_type *e_ptr = &e_info[o_ptr->name2];
if (e_ptr->gen_flags & (TRG_XTRA_D_RES)) one_dragon_ele_resistance(o_ptr);
if (e_ptr->gen_flags & (TRG_XTRA_L_RES)) one_lordly_high_resistance(o_ptr);
if (e_ptr->gen_flags & (TRG_XTRA_RES)) one_resistance(o_ptr);
+ if (e_ptr->gen_flags & (TRG_XTRA_DICE))
+ {
+ do
+ {
+ o_ptr->dd++;
+ }
+ while (one_in_(o_ptr->dd));
+
+ if (o_ptr->dd > 9) o_ptr->dd = 9;
+ }
+
+ /* Hack -- apply activatin index if needed */
+ if (e_ptr->act_idx) o_ptr->xtra2 = e_ptr->act_idx;
/* Hack -- apply extra penalties if needed */
if (object_is_cursed(o_ptr) || object_is_broken(o_ptr))
case TV_CRUSADE_BOOK:
case TV_MUSIC_BOOK:
case TV_HISSATSU_BOOK:
+ case TV_HEX_BOOK:
{
if (k_ptr->sval >= SV_BOOK_MIN_GOOD) return (TRUE);
return (FALSE);
int bs, bn;
int by, bx;
int dy, dx;
- int ty, tx;
+ int ty, tx = 0;
s16b o_idx = 0;
/* Find a grid */
- for (i = 0; !flag; i++)
+ for (i = 0; !flag && (i < 1000); i++)
{
/* Bounce around */
- if (i < 1000)
- {
- ty = rand_spread(by, 1);
- tx = rand_spread(bx, 1);
- }
+ ty = rand_spread(by, 1);
+ tx = rand_spread(bx, 1);
- /* Random locations */
- else
- {
- ty = randint0(cur_hgt);
- tx = randint0(cur_wid);
- }
+ /* Verify location */
+ if (!in_bounds(ty, tx)) continue;
/* Bounce to that location */
by = ty;
/* Require floor space */
if (!cave_drop_bold(by, bx)) continue;
- /* Avoid stacking on other objects */
- if (cave[by][bx].o_idx) continue;
-
-
/* Okay */
flag = TRUE;
}
+ if (!flag)
+ {
+ int candidates = 0, pick;
+
+ for (ty = 1; ty < cur_hgt - 1; ty++)
+ {
+ for (tx = 1; tx < cur_wid - 1; tx++)
+ {
+ /* A valid space found */
+ if (cave_drop_bold(ty, tx)) candidates++;
+ }
+ }
+
+ /* No valid place! */
+ if (!candidates)
+ {
+ /* Message */
+#ifdef JP
+ msg_format("%s¤Ï¾Ã¤¨¤¿¡£", o_name);
+#else
+ msg_format("The %s disappear%s.", o_name, (plural ? "" : "s"));
+#endif
+
+ /* Debug */
+#ifdef JP
+ if (p_ptr->wizard) msg_print("(¾²¥¹¥Ú¡¼¥¹¤¬¤Ê¤¤)");
+#else
+ if (p_ptr->wizard) msg_print("(no floor space)");
+#endif
+
+ /* Mega-Hack -- preserve artifacts */
+ if (preserve_mode)
+ {
+ /* Hack -- Preserve unknown artifacts */
+ if (object_is_fixed_artifact(j_ptr) && !object_is_known(j_ptr))
+ {
+ /* Mega-Hack -- Preserve the artifact */
+ a_info[j_ptr->name1].cur_num = 0;
+ }
+ }
+
+ /* Failure */
+ return 0;
+ }
+
+ /* Choose a random one */
+ pick = randint1(candidates);
+
+ for (ty = 1; ty < cur_hgt - 1; ty++)
+ {
+ for (tx = 1; tx < cur_wid - 1; tx++)
+ {
+ if (cave_drop_bold(ty, tx))
+ {
+ pick--;
+
+ /* Is this a picked one? */
+ if (!pick) break;
+ }
+ }
+
+ if (!pick) break;
+ }
+
+ by = ty;
+ bx = tx;
+ }
+
+
/* Grid */
c_ptr = &cave[by][bx];
}
-#define MAX_TRAPS 18
+/*
+ * Scatter some "amusing" objects near the player
+ */
+
+#define AMS_NOTHING 0x00 /* No restriction */
+#define AMS_NO_UNIQUE 0x01 /* Don't make the amusing object of uniques */
+#define AMS_FIXED_ART 0x02 /* Make a fixed artifact based on the amusing object */
+#define AMS_MULTIPLE 0x04 /* Drop 1-3 objects for one type */
+#define AMS_PILE 0x08 /* Drop 1-99 pile objects for one type */
+
+typedef struct
+{
+ int tval;
+ int sval;
+ int prob;
+ byte flag;
+} amuse_type;
-static int trap_num[MAX_TRAPS] =
+amuse_type amuse_info[] =
{
- FEAT_TRAP_TRAPDOOR,
- FEAT_TRAP_PIT,
- FEAT_TRAP_SPIKED_PIT,
- FEAT_TRAP_POISON_PIT,
- FEAT_TRAP_TY_CURSE,
- FEAT_TRAP_TELEPORT,
- FEAT_TRAP_FIRE,
- FEAT_TRAP_ACID,
- FEAT_TRAP_SLOW,
- FEAT_TRAP_LOSE_STR,
- FEAT_TRAP_LOSE_DEX,
- FEAT_TRAP_LOSE_CON,
- FEAT_TRAP_BLIND,
- FEAT_TRAP_CONFUSE,
- FEAT_TRAP_POISON,
- FEAT_TRAP_SLEEP,
- FEAT_TRAP_TRAPS,
- FEAT_TRAP_ALARM,
+ { TV_BOTTLE, SV_ANY, 5, AMS_NOTHING },
+ { TV_JUNK, SV_ANY, 3, AMS_MULTIPLE },
+ { TV_SPIKE, SV_ANY, 10, AMS_PILE },
+ { TV_STATUE, SV_ANY, 15, AMS_NOTHING },
+ { TV_CORPSE, SV_ANY, 15, AMS_NO_UNIQUE },
+ { TV_SKELETON, SV_ANY, 10, AMS_NO_UNIQUE },
+ { TV_FIGURINE, SV_ANY, 10, AMS_NO_UNIQUE },
+ { TV_PARCHMENT, SV_ANY, 1, AMS_NOTHING },
+ { TV_POLEARM, SV_TSURIZAO, 3, AMS_NOTHING }, //Fishing Pole of Taikobo
+ { TV_SWORD, SV_BROKEN_DAGGER, 3, AMS_FIXED_ART }, //Broken Dagger of Magician
+ { TV_SWORD, SV_BROKEN_DAGGER, 10, AMS_NOTHING },
+ { TV_SWORD, SV_BROKEN_SWORD, 5, AMS_NOTHING },
+ { TV_SCROLL, SV_SCROLL_AMUSEMENT, 10, AMS_NOTHING },
+
+ { 0, 0, 0 }
};
+void amusement(int y1, int x1, int num, bool known)
+{
+ object_type *i_ptr;
+ object_type object_type_body;
+ int n, t = 0;
+
+ for (n = 0; amuse_info[n].tval != 0; n++)
+ {
+ t += amuse_info[n].prob;
+ }
+
+ /* Acquirement */
+ while (num)
+ {
+ int i, k_idx, a_idx = 0;
+ int r = randint0(t);
+ bool insta_art, fixed_art;
+
+ for (i = 0; ; i++)
+ {
+ r -= amuse_info[i].prob;
+ if (r <= 0) break;
+ }
+
+ /* Get local object */
+ i_ptr = &object_type_body;
+
+ /* Wipe the object */
+ object_wipe(i_ptr);
+
+ /* Wipe the object */
+ k_idx = lookup_kind(amuse_info[i].tval, amuse_info[i].sval);
+
+ /* Paranoia - reroll if nothing */
+ if (!k_idx) continue;
+
+ /* Search an artifact index if need */
+ insta_art = (k_info[k_idx].gen_flags & TRG_INSTA_ART);
+ fixed_art = (amuse_info[i].flag & AMS_FIXED_ART);
+
+ if (insta_art || fixed_art)
+ {
+ for (a_idx = 1; a_idx < max_a_idx; a_idx++)
+ {
+ if (insta_art && !(a_info[a_idx].gen_flags & TRG_INSTA_ART)) continue;
+ if (a_info[a_idx].tval != k_info[k_idx].tval) continue;
+ if (a_info[a_idx].sval != k_info[k_idx].sval) continue;
+ if (a_info[a_idx].cur_num > 0) continue;
+ break;
+ }
+
+ if (a_idx >= max_a_idx) continue;
+ }
+
+ /* Make an object (if possible) */
+ object_prep(i_ptr, k_idx);
+ if (a_idx) i_ptr->name1 = a_idx;
+ apply_magic(i_ptr, 1, AM_NO_FIXED_ART);
+
+ if (amuse_info[i].flag & AMS_NO_UNIQUE)
+ {
+ if (r_info[i_ptr->pval].flags1 & RF1_UNIQUE) continue;
+ }
+
+ if (amuse_info[i].flag & AMS_MULTIPLE) i_ptr->number = randint1(3);
+ if (amuse_info[i].flag & AMS_PILE) i_ptr->number = randint1(99);
+
+ if (known)
+ {
+ object_aware(i_ptr);
+ object_known(i_ptr);
+ }
+
+ /* Paranoia - reroll if nothing */
+ if (!(i_ptr->k_idx)) continue;
+
+ /* Drop the object */
+ (void)drop_near(i_ptr, -1, y1, x1);
+
+ num--;
+ }
+}
+
+
+#define MAX_NORMAL_TRAPS 18
+
+/* See init_feat_variables() in init2.c */
+static s16b normal_traps[MAX_NORMAL_TRAPS];
+
+/*
+ * Initialize arrays for normal traps
+ */
+void init_normal_traps(void)
+{
+ int cur_trap = 0;
+
+ normal_traps[cur_trap++] = f_tag_to_index_in_init("TRAP_TRAPDOOR");
+ normal_traps[cur_trap++] = f_tag_to_index_in_init("TRAP_PIT");
+ normal_traps[cur_trap++] = f_tag_to_index_in_init("TRAP_SPIKED_PIT");
+ normal_traps[cur_trap++] = f_tag_to_index_in_init("TRAP_POISON_PIT");
+ normal_traps[cur_trap++] = f_tag_to_index_in_init("TRAP_TY_CURSE");
+ normal_traps[cur_trap++] = f_tag_to_index_in_init("TRAP_TELEPORT");
+ normal_traps[cur_trap++] = f_tag_to_index_in_init("TRAP_FIRE");
+ normal_traps[cur_trap++] = f_tag_to_index_in_init("TRAP_ACID");
+ normal_traps[cur_trap++] = f_tag_to_index_in_init("TRAP_SLOW");
+ normal_traps[cur_trap++] = f_tag_to_index_in_init("TRAP_LOSE_STR");
+ normal_traps[cur_trap++] = f_tag_to_index_in_init("TRAP_LOSE_DEX");
+ normal_traps[cur_trap++] = f_tag_to_index_in_init("TRAP_LOSE_CON");
+ normal_traps[cur_trap++] = f_tag_to_index_in_init("TRAP_BLIND");
+ normal_traps[cur_trap++] = f_tag_to_index_in_init("TRAP_CONFUSE");
+ normal_traps[cur_trap++] = f_tag_to_index_in_init("TRAP_POISON");
+ normal_traps[cur_trap++] = f_tag_to_index_in_init("TRAP_SLEEP");
+ normal_traps[cur_trap++] = f_tag_to_index_in_init("TRAP_TRAPS");
+ normal_traps[cur_trap++] = f_tag_to_index_in_init("TRAP_ALARM");
+}
/*
* Get random trap
while (1)
{
/* Hack -- pick a trap */
- feat = trap_num[randint0(MAX_TRAPS)];
+ feat = normal_traps[randint0(MAX_NORMAL_TRAPS)];
/* Accept non-trapdoors */
if (!have_flag(f_info[feat].flags, FF_MORE)) break;
}
+bool object_sort_comp(object_type *o_ptr, s32b o_value, object_type *j_ptr)
+{
+ int o_type, j_type;
+
+ /* Use empty slots */
+ if (!j_ptr->k_idx) return TRUE;
+
+ /* Hack -- readable books always come first */
+ if ((o_ptr->tval == REALM1_BOOK) &&
+ (j_ptr->tval != REALM1_BOOK)) return TRUE;
+ if ((j_ptr->tval == REALM1_BOOK) &&
+ (o_ptr->tval != REALM1_BOOK)) return FALSE;
+
+ if ((o_ptr->tval == REALM2_BOOK) &&
+ (j_ptr->tval != REALM2_BOOK)) return TRUE;
+ if ((j_ptr->tval == REALM2_BOOK) &&
+ (o_ptr->tval != REALM2_BOOK)) return FALSE;
+
+ /* Objects sort by decreasing type */
+ if (o_ptr->tval > j_ptr->tval) return TRUE;
+ if (o_ptr->tval < j_ptr->tval) return FALSE;
+
+ /* Non-aware (flavored) items always come last */
+ /* Can happen in the home */
+ if (!object_is_aware(o_ptr)) return FALSE;
+ if (!object_is_aware(j_ptr)) return TRUE;
+
+ /* Objects sort by increasing sval */
+ if (o_ptr->sval < j_ptr->sval) return TRUE;
+ if (o_ptr->sval > j_ptr->sval) return FALSE;
+
+ /* Unidentified objects always come last */
+ /* Objects in the home can be unknown */
+ if (!object_is_known(o_ptr)) return FALSE;
+ if (!object_is_known(j_ptr)) return TRUE;
+
+ /* Fixed artifacts, random artifacts and ego items */
+ if (object_is_fixed_artifact(o_ptr)) o_type = 3;
+ else if (o_ptr->art_name) o_type = 2;
+ else if (object_is_ego(o_ptr)) o_type = 1;
+ else o_type = 0;
+
+ if (object_is_fixed_artifact(j_ptr)) j_type = 3;
+ else if (j_ptr->art_name) j_type = 2;
+ else if (object_is_ego(j_ptr)) j_type = 1;
+ else j_type = 0;
+
+ if (o_type < j_type) return TRUE;
+ if (o_type > j_type) return FALSE;
+
+ switch (o_ptr->tval)
+ {
+ case TV_FIGURINE:
+ case TV_STATUE:
+ case TV_CORPSE:
+ case TV_CAPTURE:
+ if (r_info[o_ptr->pval].level < r_info[j_ptr->pval].level) return TRUE;
+ if ((r_info[o_ptr->pval].level == r_info[j_ptr->pval].level) && (o_ptr->pval < j_ptr->pval)) return TRUE;
+ return FALSE;
+
+ case TV_SHOT:
+ case TV_ARROW:
+ case TV_BOLT:
+ /* Objects sort by increasing hit/damage bonuses */
+ if (o_ptr->to_h + o_ptr->to_d < j_ptr->to_h + j_ptr->to_d) return TRUE;
+ if (o_ptr->to_h + o_ptr->to_d > j_ptr->to_h + j_ptr->to_d) return FALSE;
+ break;
+
+ /* Hack: otherwise identical rods sort by
+ increasing recharge time --dsb */
+ case TV_ROD:
+ if (o_ptr->pval < j_ptr->pval) return TRUE;
+ if (o_ptr->pval > j_ptr->pval) return FALSE;
+ break;
+ }
+
+ /* Objects sort by decreasing value */
+ return o_value > object_value(j_ptr);
+}
+
+
/*
* Add an item to the players inventory, and return the slot used.
*
/* Reorder the pack */
if (i < INVEN_PACK)
{
- s32b o_value, j_value;
-
/* Get the "value" of the item */
- o_value = object_value(o_ptr);
+ s32b o_value = object_value(o_ptr);
/* Scan every occupied slot */
for (j = 0; j < INVEN_PACK; j++)
{
- j_ptr = &inventory[j];
-
- /* Use empty slots */
- if (!j_ptr->k_idx) break;
-
- /* Hack -- readable books always come first */
- if ((o_ptr->tval == REALM1_BOOK) &&
- (j_ptr->tval != REALM1_BOOK)) break;
- if ((j_ptr->tval == REALM1_BOOK) &&
- (o_ptr->tval != REALM1_BOOK)) continue;
-
- if ((o_ptr->tval == REALM2_BOOK) &&
- (j_ptr->tval != REALM2_BOOK)) break;
- if ((j_ptr->tval == REALM2_BOOK) &&
- (o_ptr->tval != REALM2_BOOK)) continue;
-
- /* Objects sort by decreasing type */
- if (o_ptr->tval > j_ptr->tval) break;
- if (o_ptr->tval < j_ptr->tval) continue;
-
- /* Non-aware (flavored) items always come last */
- if (!object_is_aware(o_ptr)) continue;
- if (!object_is_aware(j_ptr)) break;
-
- /* Objects sort by increasing sval */
- if (o_ptr->sval < j_ptr->sval) break;
- if (o_ptr->sval > j_ptr->sval) continue;
-
- /* Unidentified objects always come last */
- if (!object_is_known(o_ptr)) continue;
- if (!object_is_known(j_ptr)) break;
-
- /* Hack: otherwise identical rods sort by
- increasing recharge time --dsb */
- if (o_ptr->tval == TV_ROD)
- {
- if (o_ptr->pval < j_ptr->pval) break;
- if (o_ptr->pval > j_ptr->pval) continue;
- }
-
- /* Determine the "value" of the pack item */
- j_value = object_value(j_ptr);
-
- /* Objects sort by decreasing value */
- if (o_value > j_value) break;
- if (o_value < j_value) continue;
+ if (object_sort_comp(o_ptr, o_value, &inventory[j])) break;
}
/* Use that slot */
/* Forget location */
j_ptr->iy = j_ptr->ix = 0;
- /* No longer marked */
- j_ptr->marked = 0;
+ /* Player touches it, and no longer marked */
+ j_ptr->marked = OM_TOUCHED;
/* Increase the weight */
p_ptr->total_weight += (j_ptr->number * j_ptr->weight);
int i, j, k;
object_type *o_ptr;
object_type *j_ptr;
- bool flag = FALSE;
-
+ bool flag = FALSE, combined;
- /* Combine the pack (backwards) */
- for (i = INVEN_PACK; i > 0; i--)
+ do
{
- /* Get the item */
- o_ptr = &inventory[i];
+ combined = FALSE;
- /* Skip empty items */
- if (!o_ptr->k_idx) continue;
-
- /* Scan the items above that item */
- for (j = 0; j < i; j++)
+ /* Combine the pack (backwards) */
+ for (i = INVEN_PACK; i > 0; i--)
{
- int max_num;
-
/* Get the item */
- j_ptr = &inventory[j];
+ o_ptr = &inventory[i];
/* Skip empty items */
- if (!j_ptr->k_idx) continue;
-
- /*
- * Get maximum number of the stack if these
- * are similar, get zero otherwise.
- */
- max_num = object_similar_part(j_ptr, o_ptr);
+ if (!o_ptr->k_idx) continue;
- /* Can we (partialy) drop "o_ptr" onto "j_ptr"? */
- if (max_num && j_ptr->number < max_num)
+ /* Scan the items above that item */
+ for (j = 0; j < i; j++)
{
- if (o_ptr->number + j_ptr->number <= max_num)
- {
- /* Take note */
- flag = TRUE;
+ int max_num;
- /* Add together the item counts */
- object_absorb(j_ptr, o_ptr);
+ /* Get the item */
+ j_ptr = &inventory[j];
- /* One object is gone */
- inven_cnt--;
+ /* Skip empty items */
+ if (!j_ptr->k_idx) continue;
- /* Slide everything down */
- for (k = i; k < INVEN_PACK; k++)
+ /*
+ * Get maximum number of the stack if these
+ * are similar, get zero otherwise.
+ */
+ max_num = object_similar_part(j_ptr, o_ptr);
+
+ /* Can we (partialy) drop "o_ptr" onto "j_ptr"? */
+ if (max_num && j_ptr->number < max_num)
+ {
+ if (o_ptr->number + j_ptr->number <= max_num)
{
- /* Structure copy */
- inventory[k] = inventory[k+1];
+ /* Take note */
+ flag = TRUE;
+
+ /* Add together the item counts */
+ object_absorb(j_ptr, o_ptr);
+
+ /* One object is gone */
+ inven_cnt--;
+
+ /* Slide everything down */
+ for (k = i; k < INVEN_PACK; k++)
+ {
+ /* Structure copy */
+ inventory[k] = inventory[k+1];
+ }
+
+ /* Erase the "final" slot */
+ object_wipe(&inventory[k]);
}
-
- /* Erase the "final" slot */
- object_wipe(&inventory[k]);
- }
- else
- {
- int old_num = o_ptr->number;
- int remain = j_ptr->number + o_ptr->number - max_num;
+ else
+ {
+ int old_num = o_ptr->number;
+ int remain = j_ptr->number + o_ptr->number - max_num;
#if 0
- o_ptr->number -= remain;
+ o_ptr->number -= remain;
#endif
- /* Add together the item counts */
- object_absorb(j_ptr, o_ptr);
+ /* Add together the item counts */
+ object_absorb(j_ptr, o_ptr);
- o_ptr->number = remain;
+ o_ptr->number = remain;
- /* Hack -- if rods are stacking, add the pvals (maximum timeouts) and current timeouts together. -LM- */
- if (o_ptr->tval == TV_ROD)
- {
- o_ptr->pval = o_ptr->pval * remain / old_num;
- o_ptr->timeout = o_ptr->timeout * remain / old_num;
- }
+ /* Hack -- if rods are stacking, add the pvals (maximum timeouts) and current timeouts together. -LM- */
+ if (o_ptr->tval == TV_ROD)
+ {
+ o_ptr->pval = o_ptr->pval * remain / old_num;
+ o_ptr->timeout = o_ptr->timeout * remain / old_num;
+ }
- /* Hack -- if wands are stacking, combine the charges. -LM- */
- if (o_ptr->tval == TV_WAND)
- {
- o_ptr->pval = o_ptr->pval * remain / old_num;
+ /* Hack -- if wands are stacking, combine the charges. -LM- */
+ if (o_ptr->tval == TV_WAND)
+ {
+ o_ptr->pval = o_ptr->pval * remain / old_num;
+ }
}
- }
- /* Window stuff */
- p_ptr->window |= (PW_INVEN);
-
- /* Done */
- break;
+ /* Window stuff */
+ p_ptr->window |= (PW_INVEN);
+
+ /* Take note */
+ combined = TRUE;
+
+ /* Done */
+ break;
+ }
}
}
}
+ while (combined);
/* Message */
#ifdef JP
{
int i, j, k;
s32b o_value;
- s32b j_value;
object_type forge;
object_type *q_ptr;
- object_type *j_ptr;
object_type *o_ptr;
bool flag = FALSE;
/* Scan every occupied slot */
for (j = 0; j < INVEN_PACK; j++)
{
- /* Get the item already there */
- j_ptr = &inventory[j];
-
- /* Use empty slots */
- if (!j_ptr->k_idx) break;
-
- /* Hack -- readable books always come first */
- if ((o_ptr->tval == REALM1_BOOK) &&
- (j_ptr->tval != REALM1_BOOK)) break;
- if ((j_ptr->tval == REALM1_BOOK) &&
- (o_ptr->tval != REALM1_BOOK)) continue;
-
- if ((o_ptr->tval == REALM2_BOOK) &&
- (j_ptr->tval != REALM2_BOOK)) break;
- if ((j_ptr->tval == REALM2_BOOK) &&
- (o_ptr->tval != REALM2_BOOK)) continue;
-
- /* Objects sort by decreasing type */
- if (o_ptr->tval > j_ptr->tval) break;
- if (o_ptr->tval < j_ptr->tval) continue;
-
- /* Non-aware (flavored) items always come last */
- if (!object_is_aware(o_ptr)) continue;
- if (!object_is_aware(j_ptr)) break;
-
- /* Objects sort by increasing sval */
- if (o_ptr->sval < j_ptr->sval) break;
- if (o_ptr->sval > j_ptr->sval) continue;
-
- /* Unidentified objects always come last */
- if (!object_is_known(o_ptr)) continue;
- if (!object_is_known(j_ptr)) break;
-
- /* Hack: otherwise identical rods sort by
- increasing recharge time --dsb */
- if (o_ptr->tval == TV_ROD)
- {
- if (o_ptr->pval < j_ptr->pval) break;
- if (o_ptr->pval > j_ptr->pval) continue;
- }
-
- /* Determine the "value" of the pack item */
- j_value = object_value(j_ptr);
-
-
-
- /* Objects sort by decreasing value */
- if (o_value > j_value) break;
- if (o_value < j_value) continue;
+ if (object_sort_comp(o_ptr, o_value, &inventory[j])) break;
}
/* Never move down */
else strcpy(o_name, "body"); /* Warning ability without item */
msg_format("Your %s pulsates sharply!", o_name);
#endif
- disturb(0, 0);
+ disturb(0, 1);
#ifdef JP
return get_check("ËÜÅö¤Ë¤³¤Î¤Þ¤Þ¿Ê¤à¤«¡©");
#else
else strcpy(o_name, "body"); /* Warning ability without item */
msg_format("Your %s pulsates!", o_name);
#endif
- disturb(0, 0);
+ disturb(0, 1);
#ifdef JP
return get_check("ËÜÅö¤Ë¤³¤Î¤Þ¤Þ¿Ê¤à¤«¡©");
#else
{TR_MAGIC_MASTERY, "magic mastery", 4, TR_MAGIC_MASTERY, 20},
{TR_STEALTH, "stealth", 4, TR_STEALTH, 40},
{TR_SEARCH, "serching", 4, TR_SEARCH, 15},
- {TR_INFRA, "inflavision", 4, TR_INFRA, 15},
+ {TR_INFRA, "infravision", 4, TR_INFRA, 15},
{TR_TUNNEL, "digging", 4, TR_TUNNEL, 15},
{TR_SPEED, "speed", 4, TR_SPEED, 12},
{TR_BLOWS, "extra attack", 1, TR_BLOWS, 20},
"",
"stealth",
"serching",
- "inflavision",
+ "infravision",
"digging",
"speed",
"extra atk",
int i, item;
int dec = 4;
bool observe = FALSE;
- int old_ds, old_dd, old_to_h, old_to_d, old_ac, old_to_a, old_pval, old_name2;
+ int old_ds, old_dd, old_to_h, old_to_d, old_ac, old_to_a, old_pval, old_name2, old_timeout;
u32b old_flgs[TR_FLAG_SIZE], new_flgs[TR_FLAG_SIZE];
object_type *o_ptr;
cptr q, s;
old_dd = o_ptr->dd;
old_pval = o_ptr->pval;
old_name2 = o_ptr->name2;
+ old_timeout = o_ptr->timeout;
if (o_ptr->curse_flags & (TRC_CURSED | TRC_HEAVY_CURSE | TRC_PERMA_CURSE)) dec--;
+ if (have_flag(old_flgs, TR_ADD_L_CURSE)) dec--;
+ if (have_flag(old_flgs, TR_ADD_H_CURSE)) dec--;
if (have_flag(old_flgs, TR_AGGRAVATE)) dec--;
if (have_flag(old_flgs, TR_NO_TELE)) dec--;
if (have_flag(old_flgs, TR_DRAIN_EXP)) dec--;
o_ptr->next_o_idx=next_o_idx;
o_ptr->marked=marked;
o_ptr->number = number;
+ if (o_ptr->tval == TV_DRAG_ARMOR) o_ptr->timeout = old_timeout;
if (item >= 0) p_ptr->total_weight += (o_ptr->weight*o_ptr->number - weight*number);
o_ptr->ident |= (IDENT_MENTAL);
object_aware(o_ptr);
}
if (!observe)
{
-#ifdef JP
- msg_print("¥¨¥Ã¥»¥ó¥¹¤ÏÃê½Ð¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£");
-#else
- msg_print("You were not able to extract any essence.");
-#endif
+ msg_print(_("¥¨¥Ã¥»¥ó¥¹¤ÏÃê½Ð¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", "You were not able to extract any essence."));
}
else
{
-#ifdef JP
- msg_print("Ãê½Ð¤·¤¿¥¨¥Ã¥»¥ó¥¹:");
-#else
- msg_print("Extracted essences:");
-#endif
+ msg_print(_("Ãê½Ð¤·¤¿¥¨¥Ã¥»¥ó¥¹:", "Extracted essences:"));
+
for (i = 0; essence_name[i]; i++)
{
if (!essence_name[i][0]) continue;
p_ptr->magic_num1[i] += drain_value[i];
p_ptr->magic_num1[i] = MIN(20000, p_ptr->magic_num1[i]);
msg_print(NULL);
- msg_format("%s...%d", essence_name[i], drain_value[i]);
+ msg_format("%s...%d%s", essence_name[i], drain_value[i], _("¡£", ". "));
}
}
+ /* Apply autodestroy/inscription to the drained item */
+ autopick_alter_item(item, TRUE);
+
/* Combine the pack */
p_ptr->notice |= (PN_COMBINE | PN_REORDER);
case 5: add_essence(10);break;
}
}
+
+
+/*
+ * Torches have special abilities when they are flaming.
+ */
+void torch_flags(object_type *o_ptr, u32b *flgs)
+{
+ if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_TORCH))
+ {
+ if (o_ptr->xtra4 > 0)
+ {
+ add_flag(flgs, TR_BRAND_FIRE);
+ add_flag(flgs, TR_KILL_UNDEAD);
+ add_flag(flgs, TR_THROW);
+ }
+ }
+}
+
+void torch_dice(object_type *o_ptr, int *dd, int *ds)
+{
+ if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_TORCH))
+ {
+ if (o_ptr->xtra4 > 0)
+ {
+ (*dd) = 1;
+ (*ds) = 6;
+ }
+ }
+}
+
+void torch_lost_fuel(object_type *o_ptr)
+{
+ if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_TORCH))
+ {
+ o_ptr->xtra4 -= (FUEL_TORCH / 25);
+ if (o_ptr->xtra4 < 0) o_ptr->xtra4;
+ }
+}