3 * @brief 店の処理 / Store commands
6 * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke\n
7 * This software may be copied and distributed for educational, research, and\n
8 * not for profit purposes provided that this copyright and statement are\n
9 * included in all such copies.\n
10 * 2014 Deskull rearranged comment for Doxygen.
14 #include "cmd-zapwand.h"
18 static int cur_store_num = 0;
19 static int store_top = 0;
20 static int store_bottom = 0;
21 static int xtra_stock = 0;
22 static store_type *st_ptr = NULL;
23 static const owner_type *ot_ptr = NULL;
24 static s16b old_town_num = 0;
25 static s16b inner_town_num = 0;
26 #define RUMOR_CHANCE 8
28 #define MAX_COMMENT_1 6
30 static cptr comment_1[MAX_COMMENT_1] =
51 /*! ブラックマーケット追加メッセージ(承諾) */
52 static cptr comment_1_B[MAX_COMMENT_1] = {
61 #define MAX_COMMENT_2A 2
63 static cptr comment_2a[MAX_COMMENT_2A] =
66 "私の忍耐力を試しているのかい? $%s が最後だ。",
67 "我慢にも限度があるぞ。 $%s が最後だ。"
69 "You try my patience. %s is final.",
70 "My patience grows thin. %s is final."
75 #define MAX_COMMENT_2B 12
77 static cptr comment_2b[MAX_COMMENT_2B] =
80 " $%s ぐらいは出さなきゃダメだよ。",
83 "何て奴だ! $%s 以下はあり得ないぞ。",
84 "それじゃ少なすぎる! $%s は欲しいところだ。",
85 "バカにしている! $%s はもらわないと。",
87 "おいおい! $%s を考えてくれないか?",
88 "1000匹のオークのノミに苦しめられるがいい! $%s だ。",
89 "お前の大切なものに災いあれ! $%s でどうだ。",
90 "モルゴスに賞味されるがいい!本当は $%s なんだろう?",
91 "お前の母親はオーガか! $%s は出すつもりなんだろ?"
93 "I can take no less than %s gold pieces.",
94 "I will accept no less than %s gold pieces.",
95 "Ha! No less than %s gold pieces.",
96 "You knave! No less than %s gold pieces.",
97 "That's a pittance! I want %s gold pieces.",
98 "That's an insult! I want %s gold pieces.",
99 "As if! How about %s gold pieces?",
100 "My arse! How about %s gold pieces?",
101 "May the fleas of 1000 orcs molest you! Try %s gold pieces.",
102 "May your most favourite parts go moldy! Try %s gold pieces.",
103 "May Morgoth find you tasty! Perhaps %s gold pieces?",
104 "Your mother was an Ogre! Perhaps %s gold pieces?"
110 /*! ブラックマーケット用追加メッセージ(売るとき) */
111 static cptr comment_2b_B[MAX_COMMENT_2B] = {
112 "いくら俺様がお人好しとはいえ $%s が限界だね。嫌なら帰りな。",
113 "金がないのかい、あんた?まずは家に帰って $%s 揃えてきな。",
114 "物の価値が分からん奴だな。これは $%s が普通なんだよ。",
115 "俺の付けた値段に文句があるのか? $%s が限界だ。",
116 "ひょっとして新手の冗談かい? $%s 持ってないなら帰りな。",
117 "うちは他の店とは違うんだよ。$%s ぐらいは出しな。",
118 "買う気がないなら帰りな。 $%s だと言っているんだ。",
119 "話にならないね。 $%s くらい持っているんだろ?",
120 "は?なんだそりゃ? $%s の間違いか、ひょっとして?",
121 "出口はあっちだよ。それとも $%s 出せるのかい、あんたに。",
122 "命知らずな奴だな。 $%s 出せば今日の所は勘弁してやるよ。",
123 "うちの店は貧乏人お断りだ。 $%s ぐらい出せないのかい?"
126 #define MAX_COMMENT_3A 2
128 static cptr comment_3a[MAX_COMMENT_3A] =
131 "私の忍耐力を試しているのかい? $%s が最後だ。",
132 "我慢にも限度があるぞ。 $%s が最後だ。"
134 "You try my patience. %s is final.",
135 "My patience grows thin. %s is final."
141 #define MAX_COMMENT_3B 12
143 static cptr comment_3b[MAX_COMMENT_3B] =
146 "本音を言うと $%s でいいんだろ?",
148 " $%s ぐらいなら出してもいいが。",
149 " $%s 以上払うなんて考えられないね。",
150 "まあ落ちついて。 $%s でどうだい?",
151 "そのガラクタなら $%s で引き取るよ。",
152 "それじゃ高すぎる! $%s がいいとこだろ。",
153 "どうせいらないんだろ! $%s でいいだろ?",
154 "だめだめ! $%s がずっとお似合いだよ。",
155 "バカにしている! $%s がせいぜいだ。",
156 " $%s なら嬉しいところだがなあ。",
157 " $%s 、それ以上はビタ一文出さないよ!"
159 "Perhaps %s gold pieces?",
160 "How about %s gold pieces?",
161 "I will pay no more than %s gold pieces.",
162 "I can afford no more than %s gold pieces.",
163 "Be reasonable. How about %s gold pieces?",
164 "I'll buy it as scrap for %s gold pieces.",
165 "That is too much! How about %s gold pieces?",
166 "That looks war surplus! Say %s gold pieces?",
167 "Never! %s is more like it.",
168 "That's an insult! %s is more like it.",
169 "%s gold pieces and be thankful for it!",
170 "%s gold pieces and not a copper more!"
176 /*! ブラックマーケット用追加メッセージ(買い取り) */
177 static cptr comment_3b_B[MAX_COMMENT_3B] = {
178 " $%s ってところだね。そのどうしようもないガラクタは。",
179 "この俺が $%s って言っているんだから、その通りにした方が身のためだぞ。",
180 "俺の優しさに甘えるのもいい加減にしておけ。 $%s だ。",
181 "その品なら $%s で売ってくれているがね、常識ある紳士はみんな。",
182 "こりゃまた、がめつい奴だな。いくら俺が温厚とはいえ $%s が限界だ。",
183 " $%s だ。別に俺はそんなガラクタ欲しくはないんだから。",
184 "俺の鑑定額が気に入らないのか? $%s 、嫌なら帰りな。",
185 " $%s で引き取ってやるよ。喜んで受け取りな、貧乏人。",
186 "物の価値が分からん奴は始末におえんな。それは $%s なんだよ。",
187 "そんなに金が欲しいのか、あんた? $%s で満足できんのか?",
188 "入る店間違えてんじゃないのか? $%s で嫌なら他をあたってくれ。",
189 "俺の言い値にケチをつける奴がいるとは! その度胸に免じて $%s だ。"
192 #define MAX_COMMENT_4A 4
194 static cptr comment_4a[MAX_COMMENT_4A] =
197 "もうたくさんだ!何度も私をわずらわせないでくれ!",
198 "うがー!一日の我慢の限度を超えている!",
199 "もういい!時間の無駄以外のなにものでもない!",
200 "もうやってられないよ!顔も見たくない!"
202 "Enough! You have abused me once too often!",
203 "Arghhh! I have had enough abuse for one day!",
204 "That does it! You shall waste my time no more!",
205 "This is getting nowhere! I'm going to Londis!"
211 /*! ブラックマーケット用追加メッセージ(怒りの頂点) */
212 static cptr comment_4a_B[MAX_COMMENT_4A] = {
213 "なめやがって!温厚な俺様でも限界があるってことを知れ!",
214 "俺をここまで怒らせて...命があるだけでもありがたいと思え!",
215 "ふざけてるのか!冷やかしなら相手を見てからにしろ!",
216 "いいかげんにしろ!今度こんなまねしたらただじゃおかねえぞ!"
219 #define MAX_COMMENT_4B 4
221 static cptr comment_4b[MAX_COMMENT_4B] =
230 "Get out of my sight!",
231 "Begone, you scoundrel!",
238 /*! ブラックマーケット用追加メッセージ(追い出し) */
239 static cptr comment_4b_B[MAX_COMMENT_4B] = {
246 #define MAX_COMMENT_5 8
248 static cptr comment_5[MAX_COMMENT_5] =
262 "You will have to do better than that!",
263 "Do you wish to do business or not?",
264 "You've got to be kidding!",
265 "You'd better be kidding!",
266 "You try my patience.",
267 "Hmmm, nice weather we're having."
273 /*! ブラックマーケット用追加メッセージ(怒り) */
274 static cptr comment_5_B[MAX_COMMENT_5] = {
285 #define MAX_COMMENT_6 4
287 static cptr comment_6[MAX_COMMENT_6] =
295 "I must have heard you wrong.",
296 "I'm sorry, I missed that.",
297 "I'm sorry, what was that?",
298 "Sorry, what was that again?"
306 * @brief 取引成功時の店主のメッセージ処理 /
310 static void say_comment_1(void)
313 /* ブラックマーケットのときは別のメッセージを出す */
314 if ( cur_store_num == STORE_BLACK ) {
315 msg_print(comment_1_B[randint0(MAX_COMMENT_1)]);
318 msg_print(comment_1[randint0(MAX_COMMENT_1)]);
321 msg_print(comment_1[randint0(MAX_COMMENT_1)]);
325 if (one_in_(RUMOR_CHANCE))
328 msg_print("店主は耳うちした:");
330 msg_print("The shopkeeper whispers something into your ear:");
338 * @brief プレイヤーがアイテムを買う時の価格代案メッセージ処理 /
339 * Continue haggling (player is buying)
340 * @param value 店主の提示価格
341 * @param annoyed 店主のいらつき度
344 static void say_comment_2(s32b value, int annoyed)
348 /* Prepare a string to insert */
349 sprintf(tmp_val, "%ld", (long)value);
354 /* Formatted message */
355 msg_format(comment_2a[randint0(MAX_COMMENT_2A)], tmp_val);
361 /* Formatted message */
363 /* ブラックマーケットの時は別のメッセージを出す */
364 if ( cur_store_num == STORE_BLACK ){
365 msg_format(comment_2b_B[randint0(MAX_COMMENT_2B)], tmp_val);
368 msg_format(comment_2b[randint0(MAX_COMMENT_2B)], tmp_val);
371 msg_format(comment_2b[randint0(MAX_COMMENT_2B)], tmp_val);
379 * @brief プレイヤーがアイテムを売る時の価格代案メッセージ処理 /
380 * Continue haggling (player is selling)
381 * @param value 店主の提示価格
382 * @param annoyed 店主のいらつき度
385 static void say_comment_3(s32b value, int annoyed)
389 /* Prepare a string to insert */
390 sprintf(tmp_val, "%ld", (long)value);
395 /* Formatted message */
396 msg_format(comment_3a[randint0(MAX_COMMENT_3A)], tmp_val);
402 /* Formatted message */
404 /* ブラックマーケットの時は別のメッセージを出す */
405 if ( cur_store_num == STORE_BLACK ){
406 msg_format(comment_3b_B[randint0(MAX_COMMENT_3B)], tmp_val);
409 msg_format(comment_3b[randint0(MAX_COMMENT_3B)], tmp_val);
412 msg_format(comment_3b[randint0(MAX_COMMENT_3B)], tmp_val);
420 * @brief 店主がプレイヤーを追い出す時のメッセージ処理 /
421 * Kick 'da bum out. -RAK-
424 static void say_comment_4(void)
427 /* ブラックマーケットの時は別のメッセージを出す */
428 if ( cur_store_num == STORE_BLACK ){
429 msg_print(comment_4a_B[randint0(MAX_COMMENT_4A)]);
430 msg_print(comment_4b_B[randint0(MAX_COMMENT_4B)]);
433 msg_print(comment_4a[randint0(MAX_COMMENT_4A)]);
434 msg_print(comment_4b[randint0(MAX_COMMENT_4B)]);
437 msg_print(comment_4a[randint0(MAX_COMMENT_4A)]);
438 msg_print(comment_4b[randint0(MAX_COMMENT_4B)]);
445 * @brief 店主がプレイヤーに取り合わない時のメッセージ処理 /
446 * You are insulting me
449 static void say_comment_5(void)
452 /* ブラックマーケットの時は別のメッセージを出す */
453 if ( cur_store_num == STORE_BLACK ){
454 msg_print(comment_5_B[randint0(MAX_COMMENT_5)]);
457 msg_print(comment_5[randint0(MAX_COMMENT_5)]);
460 msg_print(comment_5[randint0(MAX_COMMENT_5)]);
467 * @brief 店主がプレイヤーの提示を理解できなかった時のメッセージ処理 /
468 * That makes no sense.
471 static void say_comment_6(void)
473 msg_print(comment_6[randint0(MAX_COMMENT_6)]);
477 #define MAX_COMMENT_7A 4
479 static cptr comment_7a[MAX_COMMENT_7A] =
484 "誰かがむせび泣く声が聞こえる...。",
489 "You hear someone sobbing...",
490 "The shopkeeper howls in agony!"
495 #define MAX_COMMENT_7B 4
497 static cptr comment_7b[MAX_COMMENT_7B] =
507 "The shopkeeper curses at you.",
508 "The shopkeeper glares at you."
513 #define MAX_COMMENT_7C 4
515 static cptr comment_7c[MAX_COMMENT_7C] =
524 "You've made my day!",
525 "The shopkeeper giggles.",
526 "The shopkeeper laughs loudly."
531 #define MAX_COMMENT_7D 4
533 static cptr comment_7d[MAX_COMMENT_7D] =
537 "こんなおいしい思いをしたら、真面目に働けなくなるなぁ。",
542 "I think I'll retire!",
543 "The shopkeeper jumps for joy.",
544 "The shopkeeper smiles gleefully."
551 * @brief 店主が交渉を終えた際の反応を返す処理 /
552 * Let a shop-keeper React to a purchase
553 * @param price アイテムの取引額
554 * @param value アイテムの実際価値
555 * @param guess 店主が当初予想していた価値
558 * We paid "price", it was worth "value", and we thought it was worth "guess"
560 static void purchase_analyze(s32b price, s32b value, s32b guess)
562 /* Item was worthless, but we bought it */
563 if ((value <= 0) && (price > value))
566 msg_print(comment_7a[randint0(MAX_COMMENT_7A)]);
568 chg_virtue(V_HONOUR, -1);
569 chg_virtue(V_JUSTICE, -1);
575 /* Item was cheaper than we thought, and we paid more than necessary */
576 else if ((value < guess) && (price > value))
579 msg_print(comment_7b[randint0(MAX_COMMENT_7B)]);
581 chg_virtue(V_JUSTICE, -1);
583 chg_virtue(V_HONOUR, -1);
589 /* Item was a good bargain, and we got away with it */
590 else if ((value > guess) && (value < (4 * guess)) && (price < value))
593 msg_print(comment_7c[randint0(MAX_COMMENT_7C)]);
596 chg_virtue(V_HONOUR, -1);
598 chg_virtue(V_HONOUR, 1);
604 /* Item was a great bargain, and we got away with it */
605 else if ((value > guess) && (price < value))
608 msg_print(comment_7d[randint0(MAX_COMMENT_7D)]);
611 chg_virtue(V_HONOUR, -1);
613 chg_virtue(V_HONOUR, 1);
615 if (10 * price < value)
616 chg_virtue(V_SACRIFICE, 1);
626 * We store the current "store feat" here so everyone can access it
628 static int cur_store_feat;
632 * Buying and selling adjustments for race combinations.
633 * Entry[owner][player] gives the basic "cost inflation".
635 static byte rgold_adj[MAX_RACES][MAX_RACES] =
637 /*Hum, HfE, Elf, Hal, Gno, Dwa, HfO, HfT, Dun, HiE, Barbarian,
638 HfOg, HGn, HTn, Cyc, Yek, Klc, Kbd, Nbl, DkE, Drc, Mind Flayer,
639 Imp, Glm, Skl, Zombie, Vampire, Spectre, Fairy, Beastman, Ent,
640 Angel, Demon, Kutar */
643 { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
644 124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
645 115, 105, 125, 125, 125, 125, 105, 120, 105, 95, 140,
646 100, 120, 110, 105 },
649 { 110, 100, 100, 105, 110, 120, 125, 130, 110, 100, 110,
650 120, 115, 108, 115, 110, 110, 120, 120, 115, 115, 110,
651 120, 110, 110, 110, 120, 110, 100, 125, 100, 95, 140,
652 110, 115, 110, 110 },
655 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
656 120, 120, 105, 120, 110, 105, 125, 125, 110, 115, 108,
657 120, 115, 110, 110, 120, 110, 100, 125, 100, 95, 140,
658 110, 110, 105, 110 },
661 { 115, 110, 105, 95, 105, 110, 115, 130, 115, 105, 115,
662 125, 120, 120, 125, 115, 110, 120, 120, 120, 115, 115,
663 120, 110, 120, 120, 130, 110, 110, 130, 110, 95, 140,
664 115, 120, 105, 115 },
667 { 115, 115, 110, 105, 95, 110, 115, 130, 115, 110, 115,
668 120, 125, 110, 120, 110, 105, 120, 110, 110, 105, 110,
669 120, 101, 110, 110, 120, 120, 115, 130, 115, 95, 140,
670 115, 110, 110, 115 },
673 { 115, 120, 120, 110, 110, 95, 125, 135, 115, 120, 115,
674 125, 140, 130, 130, 120, 115, 115, 115, 135, 125, 120,
675 120, 105, 115, 115, 115, 115, 120, 130, 120, 95, 140,
676 115, 110, 115, 115 },
679 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
680 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
681 115, 125, 120, 120, 115, 120, 125, 115, 125, 95, 140,
682 115, 110, 115, 115 },
685 { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
686 110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
687 110, 115, 112, 112, 115, 112, 120, 110, 120, 95, 140,
688 110, 110, 115, 110 },
691 { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
692 120, 120, 105, 120, 115, 105, 115, 120, 110, 105, 105,
693 120, 105, 120, 120, 125, 120, 105, 135, 105, 95, 140,
694 100, 110, 110, 100 },
697 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
698 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
699 125, 115, 120, 120, 125, 120, 100, 125, 100, 95, 140,
700 110, 110, 105, 110 },
702 /* Human / Barbarian (copied from human) */
703 { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
704 124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
705 115, 105, 125, 125, 130, 125, 115, 120, 115, 95, 140,
706 100, 120, 110, 100 },
708 /* Half-Ogre: theoretical, copied from half-troll */
709 { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
710 110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
711 110, 115, 112, 112, 115, 112, 120, 110, 120, 95, 140,
712 110, 110, 115, 110 },
714 /* Half-Giant: theoretical, copied from half-troll */
715 { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
716 110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
717 110, 115, 112, 112, 115, 112, 130, 120, 130, 95, 140,
718 110, 110, 115, 110 },
720 /* Half-Titan: theoretical, copied from High_Elf */
721 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
722 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
723 125, 115, 120, 120, 120, 120, 130, 130, 130, 95, 140,
724 110, 110, 115, 110 },
726 /* Cyclops: theoretical, copied from half-troll */
727 { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
728 110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
729 110, 115, 112, 112, 115, 112, 130, 130, 130, 95, 140,
730 110, 110, 115, 110 },
732 /* Yeek: theoretical, copied from Half-Orc */
733 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
734 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
735 115, 125, 120, 120, 120, 120, 130, 130, 130, 95, 140,
736 115, 110, 115, 115 },
738 /* Klackon: theoretical, copied from Gnome */
739 { 115, 115, 110, 105, 95, 110, 115, 130, 115, 110, 115,
740 120, 125, 110, 120, 110, 105, 120, 110, 110, 105, 110,
741 120, 101, 110, 110, 120, 120, 130, 130, 130, 95, 140,
742 115, 110, 115, 115 },
744 /* Kobold: theoretical, copied from Half-Orc */
745 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
746 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
747 115, 125, 120, 120, 120, 120, 130, 130, 130, 95, 140,
748 115, 110, 115, 115 },
750 /* Nibelung: theoretical, copied from Dwarf */
751 { 115, 120, 120, 110, 110, 95, 125, 135, 115, 120, 115,
752 125, 140, 130, 130, 120, 115, 115, 115, 135, 125, 120,
753 120, 105, 115, 115, 120, 120, 130, 130, 130, 95, 140,
754 115, 135, 115, 115 },
757 { 110, 110, 110, 115, 120, 130, 115, 115, 120, 110, 115,
758 115, 115, 116, 115, 120, 120, 115, 115, 101, 110, 110,
759 110, 110, 112, 122, 110, 110, 110, 115, 110, 120, 120,
760 110, 101, 115, 110 },
762 /* Draconian: theoretical, copied from High_Elf */
763 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
764 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
765 125, 115, 120, 120, 120, 120, 130, 130, 130, 95, 140,
766 110, 110, 115, 110 },
768 /* Mind Flayer: theoretical, copied from High_Elf */
769 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
770 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
771 125, 115, 120, 120, 120, 120, 130, 130, 130, 95, 140,
772 110, 110, 115, 110 },
774 /* Imp: theoretical, copied from High_Elf */
775 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
776 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
777 125, 115, 120, 120, 120, 120, 130, 130, 130, 120, 120,
778 110, 110, 115, 110 },
780 /* Golem: theoretical, copied from High_Elf */
781 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
782 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
783 125, 115, 120, 120, 120, 120, 130, 130, 130, 95, 140,
784 110, 110, 115, 110 },
786 /* Skeleton: theoretical, copied from half-orc */
787 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
788 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
789 115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
790 115, 110, 125, 115 },
792 /* Zombie: Theoretical, copied from half-orc */
793 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
794 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
795 115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
796 115, 110, 125, 115 },
798 /* Vampire: Theoretical, copied from half-orc */
799 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
800 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
801 115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
802 115, 110, 125, 115 },
804 /* Spectre: Theoretical, copied from half-orc */
805 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
806 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
807 115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
808 115, 110, 125, 115 },
810 /* Sprite: Theoretical, copied from half-orc */
811 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
812 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
813 115, 125, 120, 120, 120, 120, 130, 130, 130, 95, 140,
814 115, 110, 105, 115 },
816 /* Beastman: Theoretical, copied from half-orc */
817 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
818 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
819 115, 125, 120, 120, 120, 120, 130, 130, 130, 95, 140,
820 115, 110, 115, 115 },
823 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
824 120, 120, 105, 120, 110, 105, 125, 125, 110, 115, 108,
825 120, 115, 110, 110, 120, 110, 100, 125, 100, 95, 140,
826 110, 110, 105, 110 },
829 { 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
830 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
831 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 160,
835 { 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
836 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
837 140, 140, 140, 140, 140, 140, 140, 140, 140, 160, 120,
838 140, 140, 140, 140 },
841 { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
842 124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
843 115, 105, 125, 125, 125, 125, 105, 120, 105, 95, 140,
844 100, 120, 110, 100 },
847 { 110, 110, 110, 115, 120, 130, 115, 115, 120, 110, 115,
848 115, 115, 116, 115, 120, 120, 115, 115, 101, 110, 110,
849 110, 110, 112, 122, 110, 110, 110, 115, 110, 120, 120,
850 110, 101, 115, 110 },
853 { 110, 110, 105, 105, 110, 115, 115, 115, 110, 105, 110,
854 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
855 115, 115, 125, 125, 125, 125, 105, 115, 105, 95, 140,
856 110, 115, 100, 110 },
859 { 105, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
860 124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
861 115, 105, 125, 125, 125, 125, 105, 120, 105, 95, 140,
862 100, 120, 110, 100 },
869 * Determine the price of an item (qty one) in a store.
870 * @param o_ptr 店舗に並べるオブジェクト構造体の参照ポインタ
871 * @param greed 店主の強欲度
872 * @param flip TRUEならば店主にとっての買取価格、FALSEなら売出価格を計算
876 * This function takes into account the player's charisma, and the
877 * shop-keepers friendliness, and the shop-keeper's base greed, but
878 * never lets a shop-keeper lose money in a transaction.
879 * The "greed" value should exceed 100 when the player is "buying" the
880 * item, and should be less than 100 when the player is "selling" it.
881 * Hack -- the black market always charges twice as much as it should.
882 * Charisma adjustment runs from 80 to 130
883 * Racial adjustment runs from 95 to 130
884 * Since greed/charisma/racial adjustments are centered at 100, we need
885 * to adjust (by 200) to extract a usable multiplier. Note that the
886 * "greed" value is always something (?).
889 static s32b price_item(object_type *o_ptr, int greed, bool flip)
896 /* Get the value of one of the items */
897 price = object_value(o_ptr);
899 /* Worthless items */
900 if (price <= 0) return (0L);
903 /* Compute the racial factor */
904 factor = rgold_adj[ot_ptr->owner_race][p_ptr->prace];
906 /* Add in the charisma factor */
907 factor += adj_chr_gold[p_ptr->stat_ind[A_CHR]];
913 /* Adjust for greed */
914 adjust = 100 + (300 - (greed + factor));
916 /* Never get "silly" */
917 if (adjust > 100) adjust = 100;
919 /* Mega-Hack -- Black market sucks */
920 if (cur_store_num == STORE_BLACK)
923 /* Compute the final price (with rounding) */
924 /* Hack -- prevent underflow */
925 price = (price * adjust + 50L) / 100L;
928 /* Shop is selling */
931 /* Adjust for greed */
932 adjust = 100 + ((greed + factor) - 300);
934 /* Never get "silly" */
935 if (adjust < 100) adjust = 100;
937 /* Mega-Hack -- Black market sucks */
938 if (cur_store_num == STORE_BLACK)
941 /* Compute the final price (with rounding) */
942 /* Hack -- prevent overflow */
943 price = (s32b)(((u32b)price * (u32b)adjust + 50UL) / 100UL);
946 /* Note -- Never become "free" */
947 if (price <= 0L) return (1L);
949 /* Return the price */
955 * @brief 安価な消耗品の販売数を増やし、低確率で割引にする /
956 * Certain "cheap" objects should be created in "piles"
957 * @param o_ptr 店舗に並べるオブジェクト構造体の参照ポインタ
961 * Some objects can be sold at a "discount" (in small piles)
964 static void mass_produce(object_type *o_ptr)
967 DISCOUNT_RATE discount = 0;
969 s32b cost = object_value(o_ptr);
972 /* Analyze the type */
975 /* Food, Flasks, and Lites */
980 if (cost <= 5L) size += damroll(3, 5);
981 if (cost <= 20L) size += damroll(3, 5);
982 if (cost <= 50L) size += damroll(2, 2);
989 if (cost <= 60L) size += damroll(3, 5);
990 if (cost <= 240L) size += damroll(1, 5);
991 if (o_ptr->sval == SV_SCROLL_STAR_IDENTIFY) size += damroll(3, 5);
992 if (o_ptr->sval == SV_SCROLL_STAR_REMOVE_CURSE) size += damroll(1, 4);
997 case TV_SORCERY_BOOK:
1002 case TV_ARCANE_BOOK:
1004 case TV_DAEMON_BOOK:
1005 case TV_CRUSADE_BOOK:
1007 case TV_HISSATSU_BOOK:
1010 if (cost <= 50L) size += damroll(2, 3);
1011 if (cost <= 500L) size += damroll(1, 3);
1029 if (object_is_artifact(o_ptr)) break;
1030 if (object_is_ego(o_ptr)) break;
1031 if (cost <= 10L) size += damroll(3, 5);
1032 if (cost <= 100L) size += damroll(3, 5);
1041 if (cost <= 5L) size += damroll(5, 5);
1042 if (cost <= 50L) size += damroll(5, 5);
1043 if (cost <= 500L) size += damroll(5, 5);
1049 if (cost <= 100L) size += damroll(2, 2);
1050 if (cost <= 1000L) size += damroll(2, 2);
1063 * Because many rods (and a few wands and staffs) are useful mainly
1064 * in quantity, the Black Market will occasionally have a bunch of
1071 if ((cur_store_num == STORE_BLACK) && one_in_(3))
1073 if (cost < 1601L) size += damroll(1, 5);
1074 else if (cost < 3201L) size += damroll(1, 3);
1081 /* Pick a discount */
1086 else if (one_in_(25))
1090 else if (one_in_(150))
1094 else if (one_in_(300))
1098 else if (one_in_(500))
1103 if (o_ptr->art_name)
1108 /* Save the discount */
1109 o_ptr->discount = discount;
1111 /* Save the total pile size */
1112 o_ptr->number = size - (size * discount / 100);
1114 /* Ensure that mass-produced rods and wands get the correct pvals. */
1115 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
1117 o_ptr->pval *= (PARAMETER_VALUE)o_ptr->number;
1124 * @brief 店舗に並べた品を同一品であるかどうか判定する /
1125 * Determine if a store item can "absorb" another item
1126 * @param o_ptr 判定するオブジェクト構造体の参照ポインタ1
1127 * @param j_ptr 判定するオブジェクト構造体の参照ポインタ2
1128 * @return 同一扱いできるならTRUEを返す
1131 * See "object_similar()" for the same function for the "player"
1134 static bool store_object_similar(object_type *o_ptr, object_type *j_ptr)
1138 /* Hack -- Identical items cannot be stacked */
1139 if (o_ptr == j_ptr) return (0);
1141 /* Different objects cannot be stacked */
1142 if (o_ptr->k_idx != j_ptr->k_idx) return (0);
1144 /* Different charges (etc) cannot be stacked, unless wands or rods. */
1145 if ((o_ptr->pval != j_ptr->pval) && (o_ptr->tval != TV_WAND) && (o_ptr->tval != TV_ROD)) return (0);
1147 /* Require many identical values */
1148 if (o_ptr->to_h != j_ptr->to_h) return (0);
1149 if (o_ptr->to_d != j_ptr->to_d) return (0);
1150 if (o_ptr->to_a != j_ptr->to_a) return (0);
1152 /* Require identical "ego-item" names */
1153 if (o_ptr->name2 != j_ptr->name2) return (0);
1155 /* Artifacts don't stack! */
1156 if (object_is_artifact(o_ptr) || object_is_artifact(j_ptr)) return (0);
1158 /* Hack -- Identical art_flags! */
1159 for (i = 0; i < TR_FLAG_SIZE; i++)
1160 if (o_ptr->art_flags[i] != j_ptr->art_flags[i]) return (0);
1162 /* Hack -- Never stack "powerful" items */
1163 if (o_ptr->xtra1 || j_ptr->xtra1) return (0);
1165 /* Hack -- Never stack recharging items */
1166 if (o_ptr->timeout || j_ptr->timeout) return (0);
1168 /* Require many identical values */
1169 if (o_ptr->ac != j_ptr->ac) return (0);
1170 if (o_ptr->dd != j_ptr->dd) return (0);
1171 if (o_ptr->ds != j_ptr->ds) return (0);
1173 /* Hack -- Never stack chests */
1174 if (o_ptr->tval == TV_CHEST) return (0);
1175 if (o_ptr->tval == TV_STATUE) return (0);
1176 if (o_ptr->tval == TV_CAPTURE) return (0);
1178 /* Require matching discounts */
1179 if (o_ptr->discount != j_ptr->discount) return (0);
1181 /* They match, so they must be similar */
1187 * @brief 店舗に並べた品を重ね合わせできるかどうか判定する /
1188 * Allow a store item to absorb another item
1189 * @param o_ptr 判定するオブジェクト構造体の参照ポインタ1
1190 * @param j_ptr 判定するオブジェクト構造体の参照ポインタ2
1191 * @return 重ね合わせできるならTRUEを返す
1194 * See "object_similar()" for the same function for the "player"
1197 static void store_object_absorb(object_type *o_ptr, object_type *j_ptr)
1199 int max_num = (o_ptr->tval == TV_ROD) ?
1200 MIN(99, MAX_SHORT / k_info[o_ptr->k_idx].pval) : 99;
1201 int total = o_ptr->number + j_ptr->number;
1202 int diff = (total > max_num) ? total - max_num : 0;
1204 /* Combine quantity, lose excess items */
1205 o_ptr->number = (total > max_num) ? max_num : total;
1207 /* Hack -- if rods are stacking, add the pvals (maximum timeouts) together. -LM- */
1208 if (o_ptr->tval == TV_ROD)
1210 o_ptr->pval += j_ptr->pval * (j_ptr->number - diff) / j_ptr->number;
1213 /* Hack -- if wands are stacking, combine the charges. -LM- */
1214 if (o_ptr->tval == TV_WAND)
1216 o_ptr->pval += j_ptr->pval * (j_ptr->number - diff) / j_ptr->number;
1222 * @brief 店舗に品を置くスペースがあるかどうかの判定を返す /
1223 * Check to see if the shop will be carrying too many objects -RAK-
1224 * @param o_ptr 店舗に置きたいオブジェクト構造体の参照ポインタ
1225 * @return 置き場がないなら0、重ね合わせできるアイテムがあるなら-1、スペースがあるなら1を返す。
1228 * Note that the shop, just like a player, will not accept things
1229 * it cannot hold. Before, one could "nuke" potions this way.
1230 * Return value is now int:
1232 * -1 : Can be combined to existing slot.
1233 * 1 : Cannot be combined but there are empty spaces.
1236 static int store_check_num(object_type *o_ptr)
1241 /* The "home" acts like the player */
1242 if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM))
1244 bool old_stack_force_notes = stack_force_notes;
1245 bool old_stack_force_costs = stack_force_costs;
1247 if (cur_store_num != STORE_HOME)
1249 stack_force_notes = FALSE;
1250 stack_force_costs = FALSE;
1253 /* Check all the items */
1254 for (i = 0; i < st_ptr->stock_num; i++)
1256 /* Get the existing item */
1257 j_ptr = &st_ptr->stock[i];
1259 /* Can the new object be combined with the old one? */
1260 if (object_similar(j_ptr, o_ptr))
1262 if (cur_store_num != STORE_HOME)
1264 stack_force_notes = old_stack_force_notes;
1265 stack_force_costs = old_stack_force_costs;
1272 if (cur_store_num != STORE_HOME)
1274 stack_force_notes = old_stack_force_notes;
1275 stack_force_costs = old_stack_force_costs;
1279 /* Normal stores do special stuff */
1282 /* Check all the items */
1283 for (i = 0; i < st_ptr->stock_num; i++)
1285 /* Get the existing item */
1286 j_ptr = &st_ptr->stock[i];
1288 /* Can the new object be combined with the old one? */
1289 if (store_object_similar(j_ptr, o_ptr)) return -1;
1293 /* Free space is always usable */
1295 * オプション powerup_home が設定されていると
1298 if ((cur_store_num == STORE_HOME) && ( powerup_home == FALSE )) {
1299 if (st_ptr->stock_num < ((st_ptr->stock_size) / 10)) {
1304 if (st_ptr->stock_num < st_ptr->stock_size) {
1309 /* But there was no room at the inn... */
1314 * @brief オブジェクトが祝福されているかの判定を返す /
1315 * @param o_ptr 判定したいオブジェクト構造体の参照ポインタ
1316 * @return アイテムが祝福されたアイテムならばTRUEを返す
1318 static bool is_blessed(object_type *o_ptr)
1320 u32b flgs[TR_FLAG_SIZE];
1321 object_flags(o_ptr, flgs);
1322 if (have_flag(flgs, TR_BLESSED)) return (TRUE);
1323 else return (FALSE);
1329 * @brief オブジェクトが所定の店舗で引き取れるかどうかを返す /
1330 * Determine if the current store will purchase the given item
1331 * @param o_ptr 判定したいオブジェクト構造体の参照ポインタ
1332 * @return アイテムが買い取れるならばTRUEを返す
1334 * Note that a shop-keeper must refuse to buy "worthless" items
1336 static bool store_will_buy(object_type *o_ptr)
1338 /* Hack -- The Home is simple */
1339 if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) return (TRUE);
1341 /* Switch on the store */
1342 switch (cur_store_num)
1347 /* Analyze the type */
1348 switch (o_ptr->tval)
1351 if (o_ptr->sval != SV_POTION_WATER) return FALSE;
1363 case TV_BOTTLE: /* 'Green', recycling Angband */
1378 /* Analyze the type */
1379 switch (o_ptr->tval)
1400 /* Analyze the type */
1401 switch (o_ptr->tval)
1410 case TV_HISSATSU_BOOK:
1414 if(o_ptr->sval == SV_WIZSTAFF) return (FALSE);
1426 /* Analyze the type */
1427 switch (o_ptr->tval)
1430 case TV_CRUSADE_BOOK:
1440 monster_race *r_ptr = &r_info[o_ptr->pval];
1443 if (!(r_ptr->flags3 & RF3_EVIL))
1446 if (r_ptr->flags3 & RF3_GOOD) break;
1448 /* Accept animals */
1449 if (r_ptr->flags3 & RF3_ANIMAL) break;
1452 if (my_strchr("?!", r_ptr->d_char)) break;
1458 if (is_blessed(o_ptr)) break;
1467 case STORE_ALCHEMIST:
1469 /* Analyze the type */
1470 switch (o_ptr->tval)
1484 /* Analyze the type */
1485 switch (o_ptr->tval)
1487 case TV_SORCERY_BOOK:
1488 case TV_NATURE_BOOK:
1492 case TV_ARCANE_BOOK:
1494 case TV_DAEMON_BOOK:
1508 if(o_ptr->sval == SV_WIZSTAFF) break;
1509 else return (FALSE);
1516 /* Bookstore Shop */
1519 /* Analyze the type */
1520 switch (o_ptr->tval)
1522 case TV_SORCERY_BOOK:
1523 case TV_NATURE_BOOK:
1528 case TV_ARCANE_BOOK:
1530 case TV_DAEMON_BOOK:
1531 case TV_CRUSADE_BOOK:
1542 /* XXX XXX XXX Ignore "worthless" items */
1543 if (object_value(o_ptr) <= 0) return (FALSE);
1551 * @brief 現在の町の指定された店舗のアイテムを整理する /
1552 * Combine and reorder items in store.
1553 * @param store_num 店舗ID
1554 * @return 実際に整理が行われたならばTRUEを返す。
1556 bool combine_and_reorder_home(int store_num)
1560 object_type forge, *o_ptr, *j_ptr;
1561 bool flag = FALSE, combined;
1562 store_type *old_st_ptr = st_ptr;
1563 bool old_stack_force_notes = stack_force_notes;
1564 bool old_stack_force_costs = stack_force_costs;
1566 st_ptr = &town[1].store[store_num];
1567 if (store_num != STORE_HOME)
1569 stack_force_notes = FALSE;
1570 stack_force_costs = FALSE;
1577 /* Combine the items in the home (backwards) */
1578 for (i = st_ptr->stock_num - 1; i > 0; i--)
1581 o_ptr = &st_ptr->stock[i];
1583 /* Skip empty items */
1584 if (!o_ptr->k_idx) continue;
1586 /* Scan the items above that item */
1587 for (j = 0; j < i; j++)
1592 j_ptr = &st_ptr->stock[j];
1594 /* Skip empty items */
1595 if (!j_ptr->k_idx) continue;
1598 * Get maximum number of the stack if these
1599 * are similar, get zero otherwise.
1601 max_num = object_similar_part(j_ptr, o_ptr);
1603 /* Can we (partialy) drop "o_ptr" onto "j_ptr"? */
1604 if (max_num && j_ptr->number < max_num)
1606 if (o_ptr->number + j_ptr->number <= max_num)
1608 /* Add together the item counts */
1609 object_absorb(j_ptr, o_ptr);
1611 /* One object is gone */
1612 st_ptr->stock_num--;
1614 /* Slide everything down */
1615 for (k = i; k < st_ptr->stock_num; k++)
1617 /* Structure copy */
1618 st_ptr->stock[k] = st_ptr->stock[k + 1];
1621 /* Erase the "final" slot */
1622 object_wipe(&st_ptr->stock[k]);
1626 ITEM_NUMBER old_num = o_ptr->number;
1627 ITEM_NUMBER remain = j_ptr->number + o_ptr->number - max_num;
1629 /* Add together the item counts */
1630 object_absorb(j_ptr, o_ptr);
1632 o_ptr->number = remain;
1634 /* Hack -- if rods are stacking, add the pvals (maximum timeouts) and current timeouts together. -LM- */
1635 if (o_ptr->tval == TV_ROD)
1637 o_ptr->pval = o_ptr->pval * remain / old_num;
1638 o_ptr->timeout = o_ptr->timeout * remain / old_num;
1641 /* Hack -- if wands are stacking, combine the charges. -LM- */
1642 else if (o_ptr->tval == TV_WAND)
1644 o_ptr->pval = o_ptr->pval * remain / old_num;
1661 /* Re-order the items in the home (forwards) */
1662 for (i = 0; i < st_ptr->stock_num; i++)
1665 o_ptr = &st_ptr->stock[i];
1667 /* Skip empty slots */
1668 if (!o_ptr->k_idx) continue;
1670 /* Get the "value" of the item */
1671 o_value = object_value(o_ptr);
1673 /* Scan every occupied slot */
1674 for (j = 0; j < st_ptr->stock_num; j++)
1676 if (object_sort_comp(o_ptr, o_value, &st_ptr->stock[j])) break;
1679 /* Never move down */
1680 if (j >= i) continue;
1685 /* Get local object */
1688 /* Save a copy of the moving item */
1689 object_copy(j_ptr, &st_ptr->stock[i]);
1691 /* Slide the objects */
1692 for (k = i; k > j; k--)
1694 /* Slide the item */
1695 object_copy(&st_ptr->stock[k], &st_ptr->stock[k - 1]);
1698 /* Insert the moving item */
1699 object_copy(&st_ptr->stock[j], j_ptr);
1702 st_ptr = old_st_ptr;
1703 if (store_num != STORE_HOME)
1705 stack_force_notes = old_stack_force_notes;
1706 stack_force_costs = old_stack_force_costs;
1714 * @brief 我が家にオブジェクトを加える /
1715 * Add the item "o_ptr" to the inventory of the "Home"
1716 * @param o_ptr 加えたいオブジェクトの構造体参照ポインタ
1720 * In all cases, return the slot (or -1) where the object was placed
1721 * Note that this is a hacked up version of "inven_carry()".
1722 * Also note that it may not correctly "adapt" to "knowledge" bacoming
1723 * known, the player may have to pick stuff up and drop it again.
1726 static int home_carry(object_type *o_ptr)
1732 bool old_stack_force_notes = stack_force_notes;
1733 bool old_stack_force_costs = stack_force_costs;
1735 if (cur_store_num != STORE_HOME)
1737 stack_force_notes = FALSE;
1738 stack_force_costs = FALSE;
1741 /* Check each existing item (try to combine) */
1742 for (slot = 0; slot < st_ptr->stock_num; slot++)
1744 /* Get the existing item */
1745 j_ptr = &st_ptr->stock[slot];
1747 /* The home acts just like the player */
1748 if (object_similar(j_ptr, o_ptr))
1750 /* Save the new number of items */
1751 object_absorb(j_ptr, o_ptr);
1753 if (cur_store_num != STORE_HOME)
1755 stack_force_notes = old_stack_force_notes;
1756 stack_force_costs = old_stack_force_costs;
1764 if (cur_store_num != STORE_HOME)
1766 stack_force_notes = old_stack_force_notes;
1767 stack_force_costs = old_stack_force_costs;
1772 * 隠し機能: オプション powerup_home が設定されていると
1776 if ((cur_store_num != STORE_HOME) || (powerup_home == TRUE)) {
1777 if (st_ptr->stock_num >= st_ptr->stock_size) {
1782 if (st_ptr->stock_num >= ((st_ptr->stock_size) / 10)) {
1788 /* Determine the "value" of the item */
1789 value = object_value(o_ptr);
1791 /* Check existing slots to see if we must "slide" */
1792 for (slot = 0; slot < st_ptr->stock_num; slot++)
1794 if (object_sort_comp(o_ptr, value, &st_ptr->stock[slot])) break;
1797 /* Slide the others up */
1798 for (i = st_ptr->stock_num; i > slot; i--)
1800 st_ptr->stock[i] = st_ptr->stock[i-1];
1803 /* More stuff now */
1804 st_ptr->stock_num++;
1806 /* Insert the new item */
1807 st_ptr->stock[slot] = *o_ptr;
1809 chg_virtue(V_SACRIFICE, -1);
1811 (void)combine_and_reorder_home(cur_store_num);
1813 /* Return the location */
1819 * @brief 店舗にオブジェクトを加える /
1820 * Add the item "o_ptr" to a real stores inventory.
1821 * @param o_ptr 加えたいオブジェクトの構造体参照ポインタ
1825 * In all cases, return the slot (or -1) where the object was placed
1826 * Note that this is a hacked up version of "inven_carry()".
1827 * Also note that it may not correctly "adapt" to "knowledge" bacoming
1828 * known, the player may have to pick stuff up and drop it again.
1831 static int store_carry(object_type *o_ptr)
1834 s32b value, j_value;
1838 /* Evaluate the object */
1839 value = object_value(o_ptr);
1841 /* Cursed/Worthless items "disappear" when sold */
1842 if (value <= 0) return (-1);
1844 /* All store items are fully *identified* */
1845 o_ptr->ident |= IDENT_MENTAL;
1847 /* Erase the inscription */
1848 o_ptr->inscription = 0;
1850 /* Erase the "feeling" */
1851 o_ptr->feeling = FEEL_NONE;
1853 /* Check each existing item (try to combine) */
1854 for (slot = 0; slot < st_ptr->stock_num; slot++)
1856 /* Get the existing item */
1857 j_ptr = &st_ptr->stock[slot];
1859 /* Can the existing items be incremented? */
1860 if (store_object_similar(j_ptr, o_ptr))
1862 /* Hack -- extra items disappear */
1863 store_object_absorb(j_ptr, o_ptr);
1871 if (st_ptr->stock_num >= st_ptr->stock_size) return (-1);
1874 /* Check existing slots to see if we must "slide" */
1875 for (slot = 0; slot < st_ptr->stock_num; slot++)
1878 j_ptr = &st_ptr->stock[slot];
1880 /* Objects sort by decreasing type */
1881 if (o_ptr->tval > j_ptr->tval) break;
1882 if (o_ptr->tval < j_ptr->tval) continue;
1884 /* Objects sort by increasing sval */
1885 if (o_ptr->sval < j_ptr->sval) break;
1886 if (o_ptr->sval > j_ptr->sval) continue;
1889 * Hack: otherwise identical rods sort by
1890 * increasing recharge time --dsb
1892 if (o_ptr->tval == TV_ROD)
1894 if (o_ptr->pval < j_ptr->pval) break;
1895 if (o_ptr->pval > j_ptr->pval) continue;
1898 /* Evaluate that slot */
1899 j_value = object_value(j_ptr);
1901 /* Objects sort by decreasing value */
1902 if (value > j_value) break;
1903 if (value < j_value) continue;
1906 /* Slide the others up */
1907 for (i = st_ptr->stock_num; i > slot; i--)
1909 st_ptr->stock[i] = st_ptr->stock[i-1];
1912 /* More stuff now */
1913 st_ptr->stock_num++;
1915 /* Insert the new item */
1916 st_ptr->stock[slot] = *o_ptr;
1918 /* Return the location */
1924 * @brief 店舗のオブジェクト数を増やす /
1925 * Add the item "o_ptr" to a real stores inventory.
1926 * @param item 増やしたいアイテムのID
1931 * Increase, by a given amount, the number of a certain item
1932 * in a certain store. This can result in zero items.
1934 * @todo numは本来ITEM_NUMBER型にしたい。
1936 static void store_item_increase(int item, int num)
1942 o_ptr = &st_ptr->stock[item];
1944 /* Verify the number */
1945 cnt = o_ptr->number + num;
1946 if (cnt > 255) cnt = 255;
1947 else if (cnt < 0) cnt = 0;
1948 num = cnt - o_ptr->number;
1950 /* Save the new number */
1951 o_ptr->number += (ITEM_NUMBER)num;
1956 * @brief 店舗のオブジェクト数を削除する /
1957 * Remove a slot if it is empty
1958 * @param item 削除したいアイテムのID
1961 static void store_item_optimize(int item)
1967 o_ptr = &st_ptr->stock[item];
1970 if (!o_ptr->k_idx) return;
1972 /* Must have no items */
1973 if (o_ptr->number) return;
1976 st_ptr->stock_num--;
1978 /* Slide everyone */
1979 for (j = item; j < st_ptr->stock_num; j++)
1981 st_ptr->stock[j] = st_ptr->stock[j + 1];
1984 /* Nuke the final slot */
1985 object_wipe(&st_ptr->stock[j]);
1989 * @brief ブラックマーケット用の無価値品の排除判定 /
1990 * This function will keep 'crap' out of the black market.
1991 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
1992 * @return ブラックマーケットにとって無価値な品ならばTRUEを返す
1995 * Crap is defined as any item that is "available" elsewhere
1996 * Based on a suggestion by "Lee Vogt" <lvogt@cig.mcel.mot.com>
1999 static bool black_market_crap(object_type *o_ptr)
2003 /* Ego items are never crap */
2004 if (object_is_ego(o_ptr)) return (FALSE);
2006 /* Good items are never crap */
2007 if (o_ptr->to_a > 0) return (FALSE);
2008 if (o_ptr->to_h > 0) return (FALSE);
2009 if (o_ptr->to_d > 0) return (FALSE);
2011 /* Check all stores */
2012 for (i = 0; i < MAX_STORES; i++)
2014 if (i == STORE_HOME) continue;
2015 if (i == STORE_MUSEUM) continue;
2017 /* Check every item in the store */
2018 for (j = 0; j < town[p_ptr->town_num].store[i].stock_num; j++)
2020 object_type *j_ptr = &town[p_ptr->town_num].store[i].stock[j];
2022 /* Duplicate item "type", assume crappy */
2023 if (o_ptr->k_idx == j_ptr->k_idx) return (TRUE);
2033 * @brief 店舗の品揃え変化のためにアイテムを削除する /
2034 * Attempt to delete (some of) a random item from the store
2038 * Hack -- we attempt to "maintain" piles of items when possible.
2041 static void store_delete(void)
2045 /* Pick a random slot */
2046 what = randint0(st_ptr->stock_num);
2048 /* Determine how many items are here */
2049 num = st_ptr->stock[what].number;
2051 /* Hack -- sometimes, only destroy half the items */
2052 if (randint0(100) < 50) num = (num + 1) / 2;
2054 /* Hack -- sometimes, only destroy a single item */
2055 if (randint0(100) < 50) num = 1;
2057 /* Hack -- decrement the maximum timeouts and total charges of rods and wands. -LM- */
2058 if ((st_ptr->stock[what].tval == TV_ROD) || (st_ptr->stock[what].tval == TV_WAND))
2060 st_ptr->stock[what].pval -= num * st_ptr->stock[what].pval / st_ptr->stock[what].number;
2063 /* Actually destroy (part of) the item */
2064 store_item_increase(what, -num);
2065 store_item_optimize(what);
2070 * @brief 店舗の品揃え変化のためにアイテムを追加する /
2071 * Creates a random item and gives it to a store
2075 * This algorithm needs to be rethought. A lot.
2076 * Currently, "normal" stores use a pre-built array.
2077 * Note -- the "level" given to "obj_get_num()" is a "favored"
2078 * level, that is, there is a much higher chance of getting
2079 * items with a level approaching that of the given level...
2080 * Should we check for "permission" to have the given item?
2083 static void store_create(void)
2093 /* Paranoia -- no room left */
2094 if (st_ptr->stock_num >= st_ptr->stock_size) return;
2097 /* Hack -- consider up to four items */
2098 for (tries = 0; tries < 4; tries++)
2101 if (cur_store_num == STORE_BLACK)
2103 /* Pick a level for object/magic */
2104 level = 25 + randint0(25);
2106 /* Random item (usually of given level) */
2107 i = get_obj_num(level);
2109 /* Handle failure */
2116 /* Hack -- Pick an item to sell */
2117 i = st_ptr->table[randint0(st_ptr->table_num)];
2119 /* Hack -- fake level for apply_magic() */
2120 level = rand_range(1, STORE_OBJ_LEVEL);
2124 /* Get local object */
2127 /* Create a new object of the chosen kind */
2128 object_prep(q_ptr, i);
2130 /* Apply some "low-level" magic (no artifacts) */
2131 apply_magic(q_ptr, level, AM_NO_FIXED_ART);
2133 /* Require valid object */
2134 if (!store_will_buy(q_ptr)) continue;
2136 /* Hack -- Charge lite's */
2137 if (q_ptr->tval == TV_LITE)
2139 if (q_ptr->sval == SV_LITE_TORCH) q_ptr->xtra4 = FUEL_TORCH / 2;
2140 if (q_ptr->sval == SV_LITE_LANTERN) q_ptr->xtra4 = FUEL_LAMP / 2;
2144 /* The item is "known" */
2145 object_known(q_ptr);
2147 /* Mark it storebought */
2148 q_ptr->ident |= IDENT_STORE;
2150 /* Mega-Hack -- no chests in stores */
2151 if (q_ptr->tval == TV_CHEST) continue;
2153 /* Prune the black market */
2154 if (cur_store_num == STORE_BLACK)
2156 /* Hack -- No "crappy" items */
2157 if (black_market_crap(q_ptr)) continue;
2159 /* Hack -- No "cheap" items */
2160 if (object_value(q_ptr) < 10) continue;
2162 /* No "worthless" items */
2163 /* if (object_value(q_ptr) <= 0) continue; */
2166 /* Prune normal stores */
2169 /* No "worthless" items */
2170 if (object_value(q_ptr) <= 0) continue;
2174 /* Mass produce and/or Apply discount */
2175 mass_produce(q_ptr);
2177 /* Attempt to carry the (known) item */
2178 (void)store_carry(q_ptr);
2180 /* Definitely done */
2187 * @brief 店舗の割引対象外にするかどうかを判定 /
2188 * Eliminate need to bargain if player has haggled well in the past
2189 * @param minprice アイテムの最低販売価格
2190 * @return 割引を禁止するならTRUEを返す。
2192 static bool noneedtobargain(s32b minprice)
2194 s32b good = st_ptr->good_buy;
2195 s32b bad = st_ptr->bad_buy;
2197 /* Cheap items are "boring" */
2198 if (minprice < 10L) return (TRUE);
2200 /* Perfect haggling */
2201 if (good == MAX_SHORT) return (TRUE);
2203 /* Reward good haggles, punish bad haggles, notice price */
2204 if (good > ((3 * bad) + (5 + (minprice/50)))) return (TRUE);
2206 /* Return the flag */
2212 * @brief 店主の持つプレイヤーに対する売買の良し悪し経験を記憶する /
2213 * Update the bargain info
2214 * @param price 実際の取引価格
2215 * @param minprice 店主の提示した価格
2219 static void updatebargain(s32b price, s32b minprice, int num)
2221 /* Hack -- auto-haggle */
2222 if (!manual_haggle) return;
2224 /* Cheap items are "boring" */
2225 if ((minprice/num) < 10L) return;
2227 /* Count the successful haggles */
2228 if (price == minprice)
2230 /* Just count the good haggles */
2231 if (st_ptr->good_buy < MAX_SHORT)
2237 /* Count the failed haggles */
2240 /* Just count the bad haggles */
2241 if (st_ptr->bad_buy < MAX_SHORT)
2250 * @brief 店の商品リストを再表示する /
2251 * Re-displays a single store entry
2255 static void display_entry(int pos)
2261 char o_name[MAX_NLEN];
2268 o_ptr = &st_ptr->stock[pos];
2270 /* Get the "offset" */
2271 i = (pos % store_bottom);
2273 /* Label it, clear the line --(-- */
2274 (void)sprintf(out_val, "%c) ", ((i > 25) ? toupper(I2A(i - 26)) : I2A(i)));
2275 prt(out_val, i+6, 0);
2278 if (show_item_graph)
2280 byte a = object_attr(o_ptr);
2281 char c = object_char(o_ptr);
2283 Term_queue_bigchar(cur_col, i + 6, a, c, 0, 0);
2284 if (use_bigtile) cur_col++;
2289 /* Describe an item in the home */
2290 if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM))
2294 /* Leave room for weights, if necessary -DRS- */
2295 if (show_weights) maxwid -= 10;
2297 /* Describe the object */
2298 object_desc(o_name, o_ptr, 0);
2299 o_name[maxwid] = '\0';
2300 c_put_str(tval_to_attr[o_ptr->tval], o_name, i+6, cur_col);
2305 /* Only show the weight of an individual item */
2306 int wgt = o_ptr->weight;
2308 sprintf(out_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2309 put_str(out_val, i+6, 67);
2311 (void)sprintf(out_val, "%3d.%d lb", wgt / 10, wgt % 10);
2312 put_str(out_val, i+6, 68);
2318 /* Describe an item (fully) in a store */
2321 /* Must leave room for the "price" */
2324 /* Leave room for weights, if necessary -DRS- */
2325 if (show_weights) maxwid -= 7;
2327 /* Describe the object (fully) */
2328 object_desc(o_name, o_ptr, 0);
2329 o_name[maxwid] = '\0';
2330 c_put_str(tval_to_attr[o_ptr->tval], o_name, i+6, cur_col);
2335 /* Only show the weight of an individual item */
2336 int wgt = o_ptr->weight;
2338 sprintf(out_val, "%3d.%1d", lbtokg1(wgt) , lbtokg2(wgt) );
2339 put_str(out_val, i+6, 60);
2341 (void)sprintf(out_val, "%3d.%d", wgt / 10, wgt % 10);
2342 put_str(out_val, i+6, 61);
2347 /* Display a "fixed" cost */
2348 if (o_ptr->ident & (IDENT_FIXED))
2350 /* Extract the "minimum" price */
2351 x = price_item(o_ptr, ot_ptr->min_inflate, FALSE);
2353 /* Actually draw the price (not fixed) */
2355 (void)sprintf(out_val, "%9ld固", (long)x);
2357 (void)sprintf(out_val, "%9ld F", (long)x);
2360 put_str(out_val, i+6, 68);
2363 /* Display a "taxed" cost */
2364 else if (!manual_haggle)
2366 /* Extract the "minimum" price */
2367 x = price_item(o_ptr, ot_ptr->min_inflate, FALSE);
2369 /* Hack -- Apply Sales Tax if needed */
2370 if (!noneedtobargain(x)) x += x / 10;
2372 /* Actually draw the price (with tax) */
2373 (void)sprintf(out_val, "%9ld ", (long)x);
2374 put_str(out_val, i+6, 68);
2377 /* Display a "haggle" cost */
2380 /* Extrect the "maximum" price */
2381 x = price_item(o_ptr, ot_ptr->max_inflate, FALSE);
2383 /* Actually draw the price (not fixed) */
2384 (void)sprintf(out_val, "%9ld ", (long)x);
2385 put_str(out_val, i+6, 68);
2392 * @brief 店の商品リストを表示する /
2393 * Displays a store's inventory -RAK-
2396 * All prices are listed as "per individual object". -BEN-
2398 static void display_inventory(void)
2402 /* Display the next 12 items */
2403 for (k = 0; k < store_bottom; k++)
2405 /* Do not display "dead" items */
2406 if (store_top + k >= st_ptr->stock_num) break;
2408 /* Display that line */
2409 display_entry(store_top + k);
2412 /* Erase the extra lines and the "more" prompt */
2413 for (i = k; i < store_bottom + 1; i++) prt("", i + 6, 0);
2415 /* Assume "no current page" */
2417 put_str(" ", 5, 20);
2419 put_str(" ", 5, 20);
2423 /* Visual reminder of "more items" */
2424 if (st_ptr->stock_num > store_bottom)
2426 /* Show "more" reminder (after the last item) */
2428 prt("-続く-", k + 6, 3);
2430 prt("-more-", k + 6, 3);
2434 /* Indicate the "current page" */
2435 /* Trailing spaces are to display (Page xx) and (Page x) */
2437 put_str(format("(%dページ) ", store_top/store_bottom + 1), 5, 20);
2439 put_str(format("(Page %d) ", store_top/store_bottom + 1), 5, 20);
2444 if (cur_store_num == STORE_HOME || cur_store_num == STORE_MUSEUM)
2446 k = st_ptr->stock_size;
2448 if (cur_store_num == STORE_HOME && !powerup_home) k /= 10;
2450 put_str(format("アイテム数: %4d/%4d", st_ptr->stock_num, k), 19 + xtra_stock, 27);
2452 put_str(format("Objects: %4d/%4d", st_ptr->stock_num, k), 19 + xtra_stock, 30);
2459 * @brief プレイヤーの所持金を表示する /
2460 * Displays players gold -RAK-
2464 static void store_prt_gold(void)
2469 prt("手持ちのお金: ", 19 + xtra_stock, 53);
2471 prt("Gold Remaining: ", 19 + xtra_stock, 53);
2475 sprintf(out_val, "%9ld", (long)p_ptr->au);
2476 prt(out_val, 19 + xtra_stock, 68);
2480 * @brief 店舗情報全体を表示するメインルーチン /
2481 * Displays store (after clearing screen) -RAK-
2485 static void display_store(void)
2493 /* The "Home" is special */
2494 if (cur_store_num == STORE_HOME)
2496 /* Put the owner name */
2498 put_str("我が家", 3, 31);
2500 put_str("Your Home", 3, 30);
2504 /* Label the item descriptions */
2506 put_str("アイテムの一覧", 5, 4);
2508 put_str("Item Description", 5, 3);
2512 /* If showing weights, show label */
2516 put_str("重さ", 5, 72);
2518 put_str("Weight", 5, 70);
2524 /* The "Home" is special */
2525 else if (cur_store_num == STORE_MUSEUM)
2527 /* Put the owner name */
2529 put_str("博物館", 3, 31);
2531 put_str("Museum", 3, 30);
2535 /* Label the item descriptions */
2537 put_str("アイテムの一覧", 5, 4);
2539 put_str("Item Description", 5, 3);
2543 /* If showing weights, show label */
2547 put_str("重さ", 5, 72);
2549 put_str("Weight", 5, 70);
2558 cptr store_name = (f_name + f_info[cur_store_feat].name);
2559 cptr owner_name = (ot_ptr->owner_name);
2560 cptr race_name = race_info[ot_ptr->owner_race].title;
2562 /* Put the owner name and race */
2563 sprintf(buf, "%s (%s)", owner_name, race_name);
2564 put_str(buf, 3, 10);
2566 /* Show the max price in the store (above prices) */
2567 sprintf(buf, "%s (%ld)", store_name, (long)(ot_ptr->max_cost));
2570 /* Label the item descriptions */
2572 put_str("商品の一覧", 5, 7);
2574 put_str("Item Description", 5, 3);
2578 /* If showing weights, show label */
2582 put_str("重さ", 5, 62);
2584 put_str("Weight", 5, 60);
2589 /* Label the asking price (in stores) */
2591 put_str("価格", 5, 73);
2593 put_str("Price", 5, 72);
2598 /* Display the current gold */
2601 /* Draw in the inventory */
2602 display_inventory();
2608 * @brief 店舗からアイテムを選択する /
2609 * Get the ID of a store item and return its value -RAK-
2610 * @param com_val 選択IDを返す参照ポインタ
2611 * @param pmt メッセージキャプション
2614 * @return 実際に選択したらTRUE、キャンセルしたらFALSE
2616 static int get_stock(COMMAND_CODE *com_val, cptr pmt, int i, int j)
2622 #ifdef ALLOW_REPEAT /* TNB */
2624 /* Get the item index */
2625 if (repeat_pull(com_val))
2627 /* Verify the item */
2628 if ((*com_val >= i) && (*com_val <= j))
2635 #endif /* ALLOW_REPEAT -- TNB */
2637 /* Paranoia XXX XXX XXX */
2641 /* Assume failure */
2644 /* Build the prompt */
2646 hi = (j > 25) ? toupper(I2A(j - 26)) : I2A(j);
2648 (void)sprintf(out_val, "(%s:%c-%c, ESCで中断) %s",
2649 (((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) ? "アイテム" : "商品"),
2652 (void)sprintf(out_val, "(Items %c-%c, ESC to exit) %s",
2657 /* Ask until done */
2663 if (!get_com(out_val, &command, FALSE)) break;
2666 if (islower(command))
2668 else if (isupper(command))
2669 k = A2I(tolower(command)) + 26;
2673 /* Legal responses */
2674 if ((k >= i) && (k <= j))
2684 /* Clear the prompt */
2688 if (command == ESCAPE) return (FALSE);
2690 #ifdef ALLOW_REPEAT /* TNB */
2692 repeat_push(*com_val);
2694 #endif /* ALLOW_REPEAT -- TNB */
2702 * @brief 店主の不満度を増やし、プレイヤーを締め出す判定と処理を行う /
2703 * Increase the insult counter and get angry if too many -RAK-
2704 * @return プレイヤーを締め出す場合TRUEを返す
2706 static int increase_insults(void)
2708 /* Increase insults */
2709 st_ptr->insult_cur++;
2711 /* Become insulted */
2712 if (st_ptr->insult_cur > ot_ptr->insult_max)
2718 st_ptr->insult_cur = 0;
2719 st_ptr->good_buy = 0;
2720 st_ptr->bad_buy = 0;
2723 st_ptr->store_open = turn + TURNS_PER_TICK*TOWN_DAWN/8 + randint1(TURNS_PER_TICK*TOWN_DAWN/8);
2735 * @brief 店主の不満度を減らす /
2736 * Decrease insults -RAK-
2737 * @return プレイヤーを締め出す場合TRUEを返す
2739 static void decrease_insults(void)
2741 /* Decrease insults */
2742 if (st_ptr->insult_cur) st_ptr->insult_cur--;
2747 * @brief 店主の不満度が増えた場合のみのメッセージを表示する /
2748 * Have insulted while haggling -RAK-
2749 * @return プレイヤーを締め出す場合TRUEを返す
2751 static int haggle_insults(void)
2753 /* Increase insults */
2754 if (increase_insults()) return (TRUE);
2756 /* Display and flush insult */
2765 * Mega-Hack -- Enable "increments"
2767 static bool allow_inc = FALSE;
2770 * Mega-Hack -- Last "increment" during haggling
2772 static s32b last_inc = 0L;
2776 * @brief 交渉価格を確認と認証の是非を行う /
2779 * @param poffer 別途価格提示をした場合の値を返す参照ポインタ
2780 * @param price 現在の交渉価格
2781 * @param final 最終確定価格ならばTRUE
2782 * @return プレイヤーを締め出す場合TRUEを返す
2784 static int get_haggle(cptr pmt, s32b *poffer, s32b price, int final)
2794 /* Clear old increment if necessary */
2795 if (!allow_inc) last_inc = 0L;
2802 sprintf(buf, "%s [承諾] ", pmt);
2804 sprintf(buf, "%s [accept] ", pmt);
2809 /* Old (negative) increment, and not final */
2810 else if (last_inc < 0)
2813 sprintf(buf, "%s [-$%ld] ", pmt, (long)(ABS(last_inc)));
2815 sprintf(buf, "%s [-%ld] ", pmt, (long)(ABS(last_inc)));
2820 /* Old (positive) increment, and not final */
2821 else if (last_inc > 0)
2824 sprintf(buf, "%s [+$%ld] ", pmt, (long)(ABS(last_inc)));
2826 sprintf(buf, "%s [+%ld] ", pmt, (long)(ABS(last_inc)));
2834 sprintf(buf, "%s ", pmt);
2838 /* Paranoia XXX XXX XXX */
2842 /* Ask until done */
2847 /* Display prompt */
2851 strcpy(out_val, "");
2854 * Ask the user for a response.
2855 * Don't allow to use numpad as cursor key.
2857 res = askfor_aux(out_val, 32, FALSE);
2863 if (!res) return FALSE;
2865 /* Skip leading spaces */
2866 for (p = out_val; *p == ' '; p++) /* loop */;
2868 /* Empty response */
2871 /* Accept current price */
2879 /* Use previous increment */
2880 if (allow_inc && last_inc)
2882 *poffer += last_inc;
2887 /* Normal response */
2890 /* Extract a number */
2893 /* Handle "incremental" number */
2894 if ((*p == '+' || *p == '-'))
2896 /* Allow increments */
2899 /* Use the given "increment" */
2906 /* Handle normal number */
2909 /* Use the given "number" */
2918 msg_print("値がおかしいです。");
2920 msg_print("Invalid response.");
2932 * @brief 店主がプレイヤーからの交渉価格を判断する /
2933 * Receive an offer (from the player)
2935 * @param poffer 店主からの交渉価格を返す参照ポインタ
2936 * @param last_offer 現在の交渉価格
2937 * @param factor 店主の価格基準倍率
2938 * @param price アイテムの実価値
2939 * @param final 最終価格確定ならばTRUE
2940 * @return プレイヤーの価格に対して不服ならばTRUEを返す /
2941 * Return TRUE if offer is NOT okay
2943 static bool receive_offer(cptr pmt, s32b *poffer,
2944 s32b last_offer, int factor,
2945 s32b price, int final)
2947 /* Haggle till done */
2950 /* Get a haggle (or cancel) */
2951 if (!get_haggle(pmt, poffer, price, final)) return (TRUE);
2953 /* Acceptable offer */
2954 if (((*poffer) * factor) >= (last_offer * factor)) break;
2956 /* Insult, and check for kicked out */
2957 if (haggle_insults()) return (TRUE);
2959 /* Reject offer (correctly) */
2960 (*poffer) = last_offer;
2969 * @brief プレイヤーが購入する時の値切り処理メインルーチン /
2970 * Haggling routine -RAK-
2971 * @param o_ptr オブジェクトの構造体参照ポインタ
2972 * @param price 最終価格を返す参照ポインタ
2973 * @return プレイヤーの価格に対して店主が不服ならばTRUEを返す /
2974 * Return TRUE if purchase is NOT successful
2976 static bool purchase_haggle(object_type *o_ptr, s32b *price)
2978 s32b cur_ask, final_ask;
2979 s32b last_offer, offer;
2981 s32b min_per, max_per;
2982 int flag, loop_flag, noneed;
2983 int annoyed = 0, final = FALSE;
2985 bool cancel = FALSE;
2990 cptr pmt = "Asking";
3000 /* Extract the starting offer and the final offer */
3001 cur_ask = price_item(o_ptr, ot_ptr->max_inflate, FALSE);
3002 final_ask = price_item(o_ptr, ot_ptr->min_inflate, FALSE);
3004 /* Determine if haggling is necessary */
3005 noneed = noneedtobargain(final_ask);
3007 /* No need to haggle */
3008 if (noneed || !manual_haggle)
3010 /* No need to haggle */
3013 /* Message summary */
3015 msg_print("結局この金額にまとまった。");
3017 msg_print("You eventually agree upon the price.");
3023 /* No haggle option */
3026 /* Message summary */
3028 msg_print("すんなりとこの金額にまとまった。");
3030 msg_print("You quickly agree upon the price.");
3035 /* Apply Sales Tax */
3036 final_ask += final_ask / 10;
3040 cur_ask = final_ask;
3042 /* Go to final offer */
3046 pmt = "Final Offer";
3053 /* Haggle for the whole pile */
3054 cur_ask *= o_ptr->number;
3055 final_ask *= o_ptr->number;
3058 /* Haggle parameters */
3059 min_per = ot_ptr->haggle_per;
3060 max_per = min_per * 3;
3062 /* Mega-Hack -- artificial "last offer" value */
3063 last_offer = object_value(o_ptr) * o_ptr->number;
3064 last_offer = last_offer * (200 - (int)(ot_ptr->max_inflate)) / 100L;
3065 if (last_offer <= 0) last_offer = 1;
3070 /* No incremental haggling yet */
3073 /* Haggle until done */
3074 for (flag = FALSE; !flag; )
3078 while (!flag && loop_flag)
3080 (void)sprintf(out_val, "%s : %ld", pmt, (long)cur_ask);
3081 put_str(out_val, 1, 0);
3083 cancel = receive_offer("提示する金額? ",
3085 cancel = receive_offer("What do you offer? ",
3088 &offer, last_offer, 1, cur_ask, final);
3094 else if (offer > cur_ask)
3099 else if (offer == cur_ask)
3112 x1 = 100 * (offer - last_offer) / (cur_ask - last_offer);
3115 if (haggle_insults())
3121 else if (x1 > max_per)
3124 if (x1 < max_per) x1 = max_per;
3126 x2 = rand_range(x1-2, x1+2);
3127 x3 = ((cur_ask - offer) * x2 / 100L) + 1;
3128 /* don't let the price go up */
3133 if (cur_ask < final_ask)
3136 cur_ask = final_ask;
3140 pmt = "Final Offer";
3146 (void)(increase_insults());
3151 else if (offer >= cur_ask)
3163 (void)sprintf(out_val, "前回の提示金額: $%ld",
3165 (void)sprintf(out_val, "Your last offer: %ld",
3169 put_str(out_val, 1, 39);
3170 say_comment_2(cur_ask, annoyed);
3176 if (cancel) return (TRUE);
3178 /* Update bargaining info */
3179 updatebargain(*price, final_ask, o_ptr->number);
3187 * @brief プレイヤーが売却する時の値切り処理メインルーチン /
3188 * Haggling routine -RAK-
3189 * @param o_ptr オブジェクトの構造体参照ポインタ
3190 * @param price 最終価格を返す参照ポインタ
3191 * @return プレイヤーの価格に対して店主が不服ならばTRUEを返す /
3192 * Return TRUE if purchase is NOT successful
3194 static bool sell_haggle(object_type *o_ptr, s32b *price)
3196 s32b purse, cur_ask, final_ask;
3197 s32b last_offer = 0, offer = 0;
3199 s32b min_per, max_per;
3200 int flag, loop_flag, noneed;
3201 int annoyed = 0, final = FALSE;
3202 bool cancel = FALSE;
3215 /* Obtain the starting offer and the final offer */
3216 cur_ask = price_item(o_ptr, ot_ptr->max_inflate, TRUE);
3217 final_ask = price_item(o_ptr, ot_ptr->min_inflate, TRUE);
3219 /* Determine if haggling is necessary */
3220 noneed = noneedtobargain(final_ask);
3222 /* Get the owner's payout limit */
3223 purse = (s32b)(ot_ptr->max_cost);
3225 /* No need to haggle */
3226 if (noneed || !manual_haggle || (final_ask >= purse))
3228 /* Apply Sales Tax (if needed) */
3229 if (!manual_haggle && !noneed)
3231 final_ask -= final_ask / 10;
3234 /* No reason to haggle */
3235 if (final_ask >= purse)
3239 msg_print("即座にこの金額にまとまった。");
3241 msg_print("You instantly agree upon the price.");
3246 /* Offer full purse */
3250 /* No need to haggle */
3255 msg_print("結局この金額にまとまった。");
3257 msg_print("You eventually agree upon the price.");
3263 /* No haggle option */
3266 /* Message summary */
3268 msg_print("すんなりとこの金額にまとまった。");
3270 msg_print("You quickly agree upon the price.");
3277 cur_ask = final_ask;
3284 pmt = "Final Offer";
3289 /* Haggle for the whole pile */
3290 cur_ask *= o_ptr->number;
3291 final_ask *= o_ptr->number;
3294 /* XXX XXX XXX Display commands */
3296 /* Haggling parameters */
3297 min_per = ot_ptr->haggle_per;
3298 max_per = min_per * 3;
3300 /* Mega-Hack -- artificial "last offer" value */
3301 last_offer = object_value(o_ptr) * o_ptr->number;
3302 last_offer = last_offer * ot_ptr->max_inflate / 100L;
3307 /* No incremental haggling yet */
3311 for (flag = FALSE; !flag; )
3317 (void)sprintf(out_val, "%s : %ld", pmt, (long)cur_ask);
3318 put_str(out_val, 1, 0);
3320 cancel = receive_offer("提示する価格? ",
3322 cancel = receive_offer("What price do you ask? ",
3325 &offer, last_offer, -1, cur_ask, final);
3331 else if (offer < cur_ask)
3334 /* rejected, reset offer for incremental haggling */
3337 else if (offer == cur_ask)
3348 if (flag || !loop_flag) break;
3353 x1 = 100 * (last_offer - offer) / (last_offer - cur_ask);
3356 if (haggle_insults())
3362 else if (x1 > max_per)
3365 if (x1 < max_per) x1 = max_per;
3367 x2 = rand_range(x1-2, x1+2);
3368 x3 = ((offer - cur_ask) * x2 / 100L) + 1;
3369 /* don't let the price go down */
3373 if (cur_ask > final_ask)
3375 cur_ask = final_ask;
3380 pmt = "Final Offer";
3388 /* 追加 $0 で買い取られてしまうのを防止 By FIRST*/
3391 (void)(increase_insults());
3394 else if (offer <= cur_ask)
3405 (void)sprintf(out_val,
3407 "前回の提示価格 $%ld", (long)last_offer);
3409 "Your last bid %ld", (long)last_offer);
3412 put_str(out_val, 1, 39);
3413 say_comment_3(cur_ask, annoyed);
3419 if (cancel) return (TRUE);
3421 /* Update bargaining info */
3422 updatebargain(*price, final_ask, o_ptr->number);
3430 * @brief 店からの購入処理のメインルーチン /
3431 * Buy an item from a store -RAK-
3434 static void store_purchase(void)
3437 COMMAND_CODE item, item_new;
3448 char o_name[MAX_NLEN];
3452 if (cur_store_num == STORE_MUSEUM)
3455 msg_print("博物館から取り出すことはできません。");
3457 msg_print("Museum.");
3463 if (st_ptr->stock_num <= 0)
3465 if (cur_store_num == STORE_HOME)
3467 msg_print("我が家には何も置いてありません。");
3469 msg_print("Your home is empty.");
3474 msg_print("現在商品の在庫を切らしています。");
3476 msg_print("I am currently out of stock.");
3483 /* Find the number of objects on this and following pages */
3484 i = (st_ptr->stock_num - store_top);
3486 /* And then restrict it to the current page */
3487 if (i > store_bottom) i = store_bottom;
3491 /* ブラックマーケットの時は別のメッセージ */
3492 switch( cur_store_num ) {
3494 sprintf(out_val, "どのアイテムを取りますか? ");
3497 sprintf(out_val, "どれ? ");
3500 sprintf(out_val, "どの品物が欲しいんだい? ");
3504 if (cur_store_num == STORE_HOME)
3506 sprintf(out_val, "Which item do you want to take? ");
3510 sprintf(out_val, "Which item are you interested in? ");
3515 /* Get the item number to be bought */
3516 if (!get_stock(&item, out_val, 0, i - 1)) return;
3518 /* Get the actual index */
3519 item = item + store_top;
3521 /* Get the actual item */
3522 o_ptr = &st_ptr->stock[item];
3524 /* Assume the player wants just one of them */
3527 /* Get local object */
3530 /* Get a copy of the object */
3531 object_copy(j_ptr, o_ptr);
3534 * If a rod or wand, allocate total maximum timeouts or charges
3535 * between those purchased and left on the shelf.
3537 reduce_charges(j_ptr, o_ptr->number - amt);
3539 /* Modify quantity */
3540 j_ptr->number = amt;
3542 /* Hack -- require room in pack */
3543 if (!inven_carry_okay(j_ptr))
3546 msg_print("そんなにアイテムを持てない。");
3548 msg_print("You cannot carry that many different items.");
3554 /* Determine the "best" price (per item) */
3555 best = price_item(j_ptr, ot_ptr->min_inflate, FALSE);
3557 /* Find out how many the player wants */
3558 if (o_ptr->number > 1)
3560 /* Hack -- note cost of "fixed" items */
3561 if ((cur_store_num != STORE_HOME) &&
3562 (o_ptr->ident & IDENT_FIXED))
3565 msg_format("一つにつき $%ldです。", (long)(best));
3567 msg_format("That costs %ld gold per item.", (long)(best));
3572 /* Get a quantity */
3573 amt = get_quantity(NULL, o_ptr->number);
3575 /* Allow user abort */
3576 if (amt <= 0) return;
3579 /* Get local object */
3582 /* Get desired object */
3583 object_copy(j_ptr, o_ptr);
3586 * If a rod or wand, allocate total maximum timeouts or charges
3587 * between those purchased and left on the shelf.
3589 reduce_charges(j_ptr, o_ptr->number - amt);
3591 /* Modify quantity */
3592 j_ptr->number = amt;
3594 /* Hack -- require room in pack */
3595 if (!inven_carry_okay(j_ptr))
3598 msg_print("ザックにそのアイテムを入れる隙間がない。");
3600 msg_print("You cannot carry that many items.");
3606 /* Attempt to buy it */
3607 if (cur_store_num != STORE_HOME)
3609 /* Fixed price, quick buy */
3610 if (o_ptr->ident & (IDENT_FIXED))
3615 /* Go directly to the "best" deal */
3616 price = (best * j_ptr->number);
3622 /* Describe the object (fully) */
3623 object_desc(o_name, j_ptr, 0);
3627 msg_format("%s(%c)を購入する。", o_name, I2A(item));
3629 msg_format("Buying %s (%c).", o_name, I2A(item));
3634 /* Haggle for a final price */
3635 choice = purchase_haggle(j_ptr, &price);
3637 /* Hack -- Got kicked out */
3638 if (st_ptr->store_open >= turn) return;
3641 /* Player wants it */
3644 /* Fix the item price (if "correctly" haggled) */
3645 if (price == (best * j_ptr->number)) o_ptr->ident |= (IDENT_FIXED);
3647 /* Player can afford it */
3648 if (p_ptr->au >= price)
3653 if (cur_store_num == STORE_BLACK) /* The black market is illegal! */
3654 chg_virtue(V_JUSTICE, -1);
3655 if((o_ptr->tval == TV_BOTTLE) && (cur_store_num != STORE_HOME))
3656 chg_virtue(V_NATURE, -1);
3664 /* Spend the money */
3667 /* Update the display */
3670 /* Hack -- buying an item makes you aware of it */
3671 object_aware(j_ptr);
3673 /* Hack -- clear the "fixed" flag from the item */
3674 j_ptr->ident &= ~(IDENT_FIXED);
3676 /* Describe the transaction */
3677 object_desc(o_name, j_ptr, 0);
3681 msg_format("%sを $%ldで購入しました。", o_name, (long)price);
3683 msg_format("You bought %s for %ld gold.", o_name, (long)price);
3686 strcpy(record_o_name, o_name);
3689 if (record_buy) do_cmd_write_nikki(NIKKI_BUY, 0, o_name);
3690 object_desc(o_name, o_ptr, OD_NAME_ONLY);
3691 if(record_rand_art && o_ptr->art_name)
3692 do_cmd_write_nikki(NIKKI_ART, 0, o_name);
3694 /* Erase the inscription */
3695 j_ptr->inscription = 0;
3697 /* Erase the "feeling" */
3698 j_ptr->feeling = FEEL_NONE;
3699 j_ptr->ident &= ~(IDENT_STORE);
3700 /* Give it to the player */
3701 item_new = inven_carry(j_ptr);
3703 /* Describe the final result */
3704 object_desc(o_name, &inventory[item_new], 0);
3708 msg_format("%s(%c)を手に入れた。", o_name, index_to_label(item_new));
3710 msg_format("You have %s (%c).",
3711 o_name, index_to_label(item_new));
3714 /* Auto-inscription */
3715 autopick_alter_item(item_new, FALSE);
3717 /* Now, reduce the original stack's pval. */
3718 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
3720 o_ptr->pval -= j_ptr->pval;
3726 /* Note how many slots the store used to have */
3727 i = st_ptr->stock_num;
3729 /* Remove the bought items from the store */
3730 store_item_increase(item, -amt);
3731 store_item_optimize(item);
3733 /* Store is empty */
3734 if (st_ptr->stock_num == 0)
3737 if (one_in_(STORE_SHUFFLE))
3742 msg_print("店主は引退した。");
3744 msg_print("The shopkeeper retires.");
3748 /* Shuffle the store */
3749 store_shuffle(cur_store_num);
3752 sprintf(buf, "%s (%s)",
3753 ot_ptr->owner_name, race_info[ot_ptr->owner_race].title);
3754 put_str(buf, 3, 10);
3755 sprintf(buf, "%s (%ld)",
3756 (f_name + f_info[cur_store_feat].name), (long)(ot_ptr->max_cost));
3765 msg_print("店主は新たな在庫を取り出した。");
3767 msg_print("The shopkeeper brings out some new stock.");
3773 for (i = 0; i < 10; i++)
3775 /* Maintain the store */
3776 store_maint(p_ptr->town_num, cur_store_num);
3782 /* Redraw everything */
3783 display_inventory();
3786 /* The item is gone */
3787 else if (st_ptr->stock_num != i)
3789 /* Pick the correct screen */
3790 if (store_top >= st_ptr->stock_num) store_top -= store_bottom;
3792 /* Redraw everything */
3793 display_inventory();
3796 /* Item is still here */
3799 /* Redraw the item */
3800 display_entry(item);
3804 /* Player cannot afford it */
3807 /* Simple message (no insult) */
3809 msg_print("お金が足りません。");
3811 msg_print("You do not have enough gold.");
3818 /* Home is much easier */
3821 bool combined_or_reordered;
3823 /* Distribute charges of wands/rods */
3824 distribute_charges(o_ptr, j_ptr, amt);
3826 /* Give it to the player */
3827 item_new = inven_carry(j_ptr);
3829 /* Describe just the result */
3830 object_desc(o_name, &inventory[item_new], 0);
3834 msg_format("%s(%c)を取った。",
3836 msg_format("You have %s (%c).",
3838 o_name, index_to_label(item_new));
3843 /* Take note if we take the last one */
3844 i = st_ptr->stock_num;
3846 /* Remove the items from the home */
3847 store_item_increase(item, -amt);
3848 store_item_optimize(item);
3850 combined_or_reordered = combine_and_reorder_home(STORE_HOME);
3852 /* Hack -- Item is still here */
3853 if (i == st_ptr->stock_num)
3855 /* Redraw everything */
3856 if (combined_or_reordered) display_inventory();
3858 /* Redraw the item */
3859 else display_entry(item);
3862 /* The item is gone */
3866 if (st_ptr->stock_num == 0) store_top = 0;
3868 /* Nothing left on that screen */
3869 else if (store_top >= st_ptr->stock_num) store_top -= store_bottom;
3871 /* Redraw everything */
3872 display_inventory();
3874 chg_virtue(V_SACRIFICE, 1);
3878 /* Not kicked out */
3884 * @brief 店からの売却処理のメインルーチン /
3885 * Sell an item to the store (or home)
3888 static void store_sell(void)
3895 s32b price, value, dummy;
3904 char o_name[MAX_NLEN];
3907 /* Prepare a prompt */
3908 if (cur_store_num == STORE_HOME)
3910 q = "どのアイテムを置きますか? ";
3912 q = "Drop which item? ";
3915 else if (cur_store_num == STORE_MUSEUM)
3917 q = "どのアイテムを寄贈しますか? ";
3919 q = "Give which item? ";
3924 q = "どのアイテムを売りますか? ";
3926 q = "Sell which item? ";
3930 item_tester_no_ryoute = TRUE;
3931 /* Only allow items the store will buy */
3932 item_tester_hook = store_will_buy;
3935 /* 我が家でおかしなメッセージが出るオリジナルのバグを修正 */
3936 if (cur_store_num == STORE_HOME)
3939 s = "置けるアイテムを持っていません。";
3941 s = "You don't have any item to drop.";
3944 else if (cur_store_num == STORE_MUSEUM)
3947 s = "寄贈できるアイテムを持っていません。";
3949 s = "You don't have any item to give.";
3957 s = "You have nothing that I want.";
3961 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return;
3963 /* Get the item (in the pack) */
3966 o_ptr = &inventory[item];
3969 /* Get the item (on the floor) */
3972 o_ptr = &o_list[0 - item];
3976 /* Hack -- Cannot remove cursed items */
3977 if ((item >= INVEN_RARM) && object_is_cursed(o_ptr))
3981 msg_print("ふーむ、どうやらそれは呪われているようだね。");
3983 msg_print("Hmmm, it seems to be cursed.");
3992 /* Assume one item */
3995 /* Find out how many the player wants (letter means "all") */
3996 if (o_ptr->number > 1)
3998 /* Get a quantity */
3999 amt = get_quantity(NULL, o_ptr->number);
4001 /* Allow user abort */
4002 if (amt <= 0) return;
4005 /* Get local object */
4008 /* Get a copy of the object */
4009 object_copy(q_ptr, o_ptr);
4011 /* Modify quantity */
4012 q_ptr->number = amt;
4015 * Hack -- If a rod or wand, allocate total maximum
4016 * timeouts or charges to those being sold. -LM-
4018 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
4020 q_ptr->pval = o_ptr->pval * amt / o_ptr->number;
4023 /* Get a full description */
4024 object_desc(o_name, q_ptr, 0);
4026 /* Remove any inscription, feeling for stores */
4027 if ((cur_store_num != STORE_HOME) && (cur_store_num != STORE_MUSEUM))
4029 q_ptr->inscription = 0;
4030 q_ptr->feeling = FEEL_NONE;
4033 /* Is there room in the store (or the home?) */
4034 if (!store_check_num(q_ptr))
4036 if (cur_store_num == STORE_HOME)
4038 msg_print("我が家にはもう置く場所がない。");
4040 msg_print("Your home is full.");
4043 else if (cur_store_num == STORE_MUSEUM)
4045 msg_print("博物館はもう満杯だ。");
4047 msg_print("Museum is full.");
4052 msg_print("すいませんが、店にはもう置く場所がありません。");
4054 msg_print("I have not the room in my store to keep it.");
4062 if ((cur_store_num != STORE_HOME) && (cur_store_num != STORE_MUSEUM))
4064 /* Describe the transaction */
4066 msg_format("%s(%c)を売却する。", o_name, index_to_label(item));
4068 msg_format("Selling %s (%c).", o_name, index_to_label(item));
4074 choice = sell_haggle(q_ptr, &price);
4077 if (st_ptr->store_open >= turn) return;
4089 if (cur_store_num == STORE_BLACK) /* The black market is illegal! */
4090 chg_virtue(V_JUSTICE, -1);
4092 if((o_ptr->tval == TV_BOTTLE) && (cur_store_num != STORE_HOME))
4093 chg_virtue(V_NATURE, 1);
4096 /* Get some money */
4099 /* Update the display */
4102 /* Get the "apparent" value */
4103 dummy = object_value(q_ptr) * q_ptr->number;
4106 identify_item(o_ptr);
4108 /* Get local object */
4111 /* Get a copy of the object */
4112 object_copy(q_ptr, o_ptr);
4114 /* Modify quantity */
4115 q_ptr->number = amt;
4117 /* Make it look like to be known */
4118 q_ptr->ident |= IDENT_STORE;
4121 * Hack -- If a rod or wand, let the shopkeeper know just
4122 * how many charges he really paid for. -LM-
4124 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
4126 q_ptr->pval = o_ptr->pval * amt / o_ptr->number;
4129 /* Get the "actual" value */
4130 value = object_value(q_ptr) * q_ptr->number;
4132 /* Get the description all over again */
4133 object_desc(o_name, q_ptr, 0);
4135 /* Describe the result (in message buffer) */
4137 msg_format("%sを $%ldで売却しました。", o_name, (long)price);
4139 msg_format("You sold %s for %ld gold.", o_name, (long)price);
4142 if (record_sell) do_cmd_write_nikki(NIKKI_SELL, 0, o_name);
4144 if (!((o_ptr->tval == TV_FIGURINE) && (value > 0)))
4146 /* Analyze the prices (and comment verbally) unless a figurine*/
4147 purchase_analyze(price, value, dummy);
4151 * Hack -- Allocate charges between those wands or rods sold
4152 * and retained, unless all are being sold. -LM-
4154 distribute_charges(o_ptr, q_ptr, amt);
4156 /* Reset timeouts of the sold items */
4159 /* Take the item from the player, describe the result */
4160 inven_item_increase(item, -amt);
4161 inven_item_describe(item);
4163 /* If items remain, auto-inscribe before optimizing */
4164 if (o_ptr->number > 0)
4165 autopick_alter_item(item, FALSE);
4167 inven_item_optimize(item);
4172 /* The store gets that (known) item */
4173 item_pos = store_carry(q_ptr);
4175 /* Re-display if item is now in store */
4178 store_top = (item_pos / store_bottom) * store_bottom;
4179 display_inventory();
4184 /* Player is at museum */
4185 else if (cur_store_num == STORE_MUSEUM)
4187 char o2_name[MAX_NLEN];
4188 object_desc(o2_name, q_ptr, OD_NAME_ONLY);
4190 if (-1 == store_check_num(q_ptr))
4193 msg_print("それと同じ品物は既に博物館にあるようです。");
4195 msg_print("The same object as it is already in the Museum.");
4201 msg_print("博物館に寄贈したものは取り出すことができません!!");
4203 msg_print("You cannot take items which is given to the Museum back!!");
4207 if (!get_check(format("本当に%sを寄贈しますか?", o2_name))) return;
4209 if (!get_check(format("Really give %s to the Museum? ", o2_name))) return;
4213 identify_item(q_ptr);
4214 q_ptr->ident |= IDENT_MENTAL;
4216 /* Distribute charges of wands/rods */
4217 distribute_charges(o_ptr, q_ptr, amt);
4221 msg_format("%sを置いた。(%c)", o_name, index_to_label(item));
4223 msg_format("You drop %s (%c).", o_name, index_to_label(item));
4228 /* Take it from the players inventory */
4229 inven_item_increase(item, -amt);
4230 inven_item_describe(item);
4231 inven_item_optimize(item);
4236 /* Let the home carry it */
4237 item_pos = home_carry(q_ptr);
4239 /* Update store display */
4242 store_top = (item_pos / store_bottom) * store_bottom;
4243 display_inventory();
4246 /* Player is at home */
4249 /* Distribute charges of wands/rods */
4250 distribute_charges(o_ptr, q_ptr, amt);
4254 msg_format("%sを置いた。(%c)", o_name, index_to_label(item));
4256 msg_format("You drop %s (%c).", o_name, index_to_label(item));
4261 /* Take it from the players inventory */
4262 inven_item_increase(item, -amt);
4263 inven_item_describe(item);
4264 inven_item_optimize(item);
4269 /* Let the home carry it */
4270 item_pos = home_carry(q_ptr);
4272 /* Update store display */
4275 store_top = (item_pos / store_bottom) * store_bottom;
4276 display_inventory();
4280 if ((choice == 0) && (item >= INVEN_RARM))
4289 * @brief 店のアイテムを調べるコマンドのメインルーチン /
4290 * Examine an item in a store -JDL-
4293 static void store_examine(void)
4298 char o_name[MAX_NLEN];
4303 if (st_ptr->stock_num <= 0)
4305 if (cur_store_num == STORE_HOME)
4307 msg_print("我が家には何も置いてありません。");
4309 msg_print("Your home is empty.");
4312 else if (cur_store_num == STORE_MUSEUM)
4314 msg_print("博物館には何も置いてありません。");
4316 msg_print("Museum is empty.");
4321 msg_print("現在商品の在庫を切らしています。");
4323 msg_print("I am currently out of stock.");
4330 /* Find the number of objects on this and following pages */
4331 i = (st_ptr->stock_num - store_top);
4333 /* And then restrict it to the current page */
4334 if (i > store_bottom) i = store_bottom;
4338 sprintf(out_val, "どれを調べますか?");
4340 sprintf(out_val, "Which item do you want to examine? ");
4344 /* Get the item number to be examined */
4345 if (!get_stock(&item, out_val, 0, i - 1)) return;
4347 /* Get the actual index */
4348 item = item + store_top;
4350 /* Get the actual item */
4351 o_ptr = &st_ptr->stock[item];
4353 /* Require full knowledge */
4354 if (!(o_ptr->ident & IDENT_MENTAL))
4356 /* This can only happen in the home */
4358 msg_print("このアイテムについて特に知っていることはない。");
4360 msg_print("You have no special knowledge about that item.");
4367 object_desc(o_name, o_ptr, 0);
4371 msg_format("%sを調べている...", o_name);
4373 msg_format("Examining %s...", o_name);
4377 /* Describe it fully */
4378 if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL))
4380 msg_print("特に変わったところはないようだ。");
4382 msg_print("You see nothing special.");
4391 * @brief 博物館のアイテムを除去するコマンドのメインルーチン /
4392 * Remove an item from museum (Originally from TOband)
4395 static void museum_remove_object(void)
4400 char o_name[MAX_NLEN];
4404 if (st_ptr->stock_num <= 0)
4407 msg_print("博物館には何も置いてありません。");
4409 msg_print("Museum is empty.");
4415 /* Find the number of objects on this and following pages */
4416 i = st_ptr->stock_num - store_top;
4418 /* And then restrict it to the current page */
4419 if (i > store_bottom) i = store_bottom;
4423 sprintf(out_val, "どのアイテムの展示をやめさせますか?");
4425 sprintf(out_val, "Which item do you want to order to remove? ");
4428 /* Get the item number to be removed */
4429 if (!get_stock(&item, out_val, 0, i - 1)) return;
4431 /* Get the actual index */
4432 item = item + store_top;
4434 /* Get the actual item */
4435 o_ptr = &st_ptr->stock[item];
4438 object_desc(o_name, o_ptr, 0);
4441 msg_print("展示をやめさせたアイテムは二度と見ることはできません!");
4442 if (!get_check(format("本当に%sの展示をやめさせますか?", o_name))) return;
4444 msg_print("You cannot see items which is removed from the Museum!");
4445 if (!get_check(format("Really order to remove %s from the Museum? ", o_name))) return;
4450 msg_format("%sの展示をやめさせた。", o_name);
4452 msg_format("You ordered to remove %s.", o_name);
4455 /* Remove the items from the home */
4456 store_item_increase(item, -o_ptr->number);
4457 store_item_optimize(item);
4459 (void)combine_and_reorder_home(STORE_MUSEUM);
4461 /* The item is gone */
4464 if (st_ptr->stock_num == 0) store_top = 0;
4466 /* Nothing left on that screen */
4467 else if (store_top >= st_ptr->stock_num) store_top -= store_bottom;
4469 /* Redraw everything */
4470 display_inventory();
4477 * Hack -- set this to leave the store
4479 static bool leave_store = FALSE;
4483 * @brief 店舗処理コマンド選択のメインルーチン /
4484 * Process a command in a store
4488 * Note that we must allow the use of a few "special" commands
4489 * in the stores which are not allowed in the dungeon, and we
4490 * must disable some commands which are allowed in the dungeon
4491 * but not in the stores, to prevent chaos.
4494 static void store_process_command(void)
4496 #ifdef ALLOW_REPEAT /* TNB */
4498 /* Handle repeating the last command */
4501 #endif /* ALLOW_REPEAT -- TNB */
4503 if (rogue_like_commands && command_cmd == 'l')
4505 command_cmd = 'x'; /* hack! */
4508 /* Parse the command */
4509 switch (command_cmd)
4519 /* 1 ページ戻るコマンド: 我が家のページ数が多いので重宝するはず By BUG */
4522 if (st_ptr->stock_num <= store_bottom) {
4524 msg_print("これで全部です。");
4526 msg_print("Entire inventory is shown.");
4530 store_top -= store_bottom;
4531 if ( store_top < 0 )
4532 store_top = ((st_ptr->stock_num - 1 )/store_bottom) * store_bottom;
4533 if ( (cur_store_num == STORE_HOME) && (powerup_home == FALSE) )
4534 if ( store_top >= store_bottom ) store_top = store_bottom;
4535 display_inventory();
4543 if (st_ptr->stock_num <= store_bottom)
4546 msg_print("これで全部です。");
4548 msg_print("Entire inventory is shown.");
4554 store_top += store_bottom;
4556 * 隠しオプション(powerup_home)がセットされていないときは
4557 * 我が家では 2 ページまでしか表示しない
4559 if ((cur_store_num == STORE_HOME) &&
4560 (powerup_home == FALSE) &&
4561 (st_ptr->stock_num >= STORE_INVEN_MAX))
4563 if (store_top >= (STORE_INVEN_MAX - 1))
4570 if (store_top >= st_ptr->stock_num) store_top = 0;
4573 display_inventory();
4586 /* Get (purchase) */
4613 /*** Inventory Commands ***/
4615 /* Wear/wield equipment */
4622 /* Take off equipment */
4629 /* Destroy an item */
4636 /* Equipment list */
4643 /* Inventory list */
4651 /*** Various commands ***/
4653 /* Identify an object */
4660 /* Hack -- toggle windows */
4663 toggle_inven_equip();
4669 /*** Use various objects ***/
4674 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
4675 (p_ptr->pclass == CLASS_BERSERKER) ||
4676 (p_ptr->pclass == CLASS_NINJA) ||
4677 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4678 ) do_cmd_mind_browse();
4679 else if (p_ptr->pclass == CLASS_SMITH)
4681 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4682 do_cmd_magic_eater(TRUE, FALSE);
4683 else if (p_ptr->pclass == CLASS_SNIPER)
4684 do_cmd_snipe_browse();
4685 else do_cmd_browse();
4689 /* Inscribe an object */
4696 /* Uninscribe an object */
4699 do_cmd_uninscribe();
4705 /*** Help and Such ***/
4714 /* Identify symbol */
4717 do_cmd_query_symbol();
4721 /* Character description */
4724 p_ptr->town_num = old_town_num;
4725 do_cmd_change_name();
4726 p_ptr->town_num = inner_town_num;
4732 /*** System Commands ***/
4734 /* Hack -- User interface */
4741 /* Single line from a pref file */
4744 p_ptr->town_num = old_town_num;
4746 p_ptr->town_num = inner_town_num;
4750 /* Interact with macros */
4753 p_ptr->town_num = old_town_num;
4755 p_ptr->town_num = inner_town_num;
4759 /* Interact with visuals */
4762 p_ptr->town_num = old_town_num;
4764 p_ptr->town_num = inner_town_num;
4768 /* Interact with colors */
4771 p_ptr->town_num = old_town_num;
4773 p_ptr->town_num = inner_town_num;
4777 /* Interact with options */
4781 (void)combine_and_reorder_home(STORE_HOME);
4787 /*** Misc Commands ***/
4803 /* Repeat level feeling */
4810 /* Show previous message */
4813 do_cmd_message_one();
4817 /* Show previous messages */
4830 /* Check artifacts, uniques etc. */
4837 /* Load "screen dump" */
4840 do_cmd_load_screen();
4844 /* Save "screen dump" */
4847 do_cmd_save_screen();
4851 /* Hack -- Unknown command */
4854 if ((cur_store_num == STORE_MUSEUM) && (command_cmd == 'r'))
4856 museum_remove_object();
4861 msg_print("そのコマンドは店の中では使えません。");
4863 msg_print("That command does not work in stores.");
4874 * @brief 店舗処理全体のメインルーチン /
4875 * Enter a store, and interact with it. *
4879 * Note that we use the standard "request_command()" function
4880 * to get a command, allowing us to use "command_arg" and all
4881 * command macros and other nifty stuff, but we use the special
4882 * "shopping" argument, to force certain commands to be converted
4883 * into other commands, normally, we convert "p" (pray) and "m"
4884 * (cast magic) into "g" (get), and "s" (search) into "d" (drop).
4887 void do_cmd_store(void)
4893 bool need_redraw_store_inv; /* To redraw missiles damage and prices in store */
4897 Term_get_size(&w, &h);
4899 /* Calculate stocks per 1 page */
4900 xtra_stock = MIN(14+26, ((h > 24) ? (h - 24) : 0));
4901 store_bottom = MIN_STOCK + xtra_stock;
4903 /* Access the player grid */
4904 c_ptr = &cave[p_ptr->y][p_ptr->x];
4906 /* Verify a store */
4907 if (!cave_have_flag_grid(c_ptr, FF_STORE))
4910 msg_print("ここには店がありません。");
4912 msg_print("You see no store here.");
4918 /* Extract the store code */
4919 which = f_info[c_ptr->feat].subtype;
4921 old_town_num = p_ptr->town_num;
4922 if ((which == STORE_HOME) || (which == STORE_MUSEUM)) p_ptr->town_num = 1;
4923 if (dun_level) p_ptr->town_num = NO_TOWN;
4924 inner_town_num = p_ptr->town_num;
4926 /* Hack -- Check the "locked doors" */
4927 if ((town[p_ptr->town_num].store[which].store_open >= turn) ||
4931 msg_print("ドアに鍵がかかっている。");
4933 msg_print("The doors are locked.");
4936 p_ptr->town_num = old_town_num;
4940 /* Calculate the number of store maintainances since the last visit */
4941 maintain_num = (turn - town[p_ptr->town_num].store[which].last_visit) / (TURNS_PER_TICK * STORE_TICKS);
4943 /* Maintain the store max. 10 times */
4944 if (maintain_num > 10) maintain_num = 10;
4948 /* Maintain the store */
4949 for (i = 0; i < maintain_num; i++)
4950 store_maint(p_ptr->town_num, which);
4952 /* Save the visit */
4953 town[p_ptr->town_num].store[which].last_visit = turn;
4956 /* Forget the lite */
4959 /* Forget the view */
4963 /* Hack -- Character is in "icky" mode */
4964 character_icky = TRUE;
4967 /* No command argument */
4970 /* No repeated command */
4973 /* No automatic command */
4976 /* Do not expand macros */
4977 get_com_no_macros = TRUE;
4979 /* Save the store number */
4980 cur_store_num = which;
4982 /* Hack -- save the store feature */
4983 cur_store_feat = c_ptr->feat;
4985 /* Save the store and owner pointers */
4986 st_ptr = &town[p_ptr->town_num].store[cur_store_num];
4987 ot_ptr = &owners[cur_store_num][st_ptr->owner];
4990 /* Start at the beginning */
4993 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_BUILD);
4995 /* Display the store */
4999 leave_store = FALSE;
5001 /* Interact with player */
5002 while (!leave_store)
5004 /* Hack -- Clear line 1 */
5008 clear_from(20 + xtra_stock);
5011 /* Basic commands */
5013 prt(" ESC) 建物から出る", 21 + xtra_stock, 0);
5015 prt(" ESC) Exit from Building.", 21 + xtra_stock, 0);
5019 /* Browse if necessary */
5020 if (st_ptr->stock_num > store_bottom)
5023 prt(" -)前ページ", 22 + xtra_stock, 0);
5024 prt(" スペース) 次ページ", 23 + xtra_stock, 0);
5026 prt(" -) Previous page", 22 + xtra_stock, 0);
5027 prt(" SPACE) Next page", 23 + xtra_stock, 0);
5033 if (cur_store_num == STORE_HOME)
5036 prt("g) アイテムを取る", 21 + xtra_stock, 27);
5037 prt("d) アイテムを置く", 22 + xtra_stock, 27);
5038 prt("x) 家のアイテムを調べる", 23 + xtra_stock, 27);
5040 prt("g) Get an item.", 21 + xtra_stock, 27);
5041 prt("d) Drop an item.", 22 + xtra_stock, 27);
5042 prt("x) eXamine an item in the home.", 23 + xtra_stock, 27);
5046 /* Museum commands */
5047 else if (cur_store_num == STORE_MUSEUM)
5050 prt("d) アイテムを置く", 21 + xtra_stock, 27);
5051 prt("r) アイテムの展示をやめる", 22 + xtra_stock, 27);
5052 prt("x) 博物館のアイテムを調べる", 23 + xtra_stock, 27);
5054 prt("d) Drop an item.", 21 + xtra_stock, 27);
5055 prt("r) order to Remove an item.", 22 + xtra_stock, 27);
5056 prt("x) eXamine an item in the museum.", 23 + xtra_stock, 27);
5060 /* Shop commands XXX XXX XXX */
5064 prt("p) 商品を買う", 21 + xtra_stock, 30);
5065 prt("s) アイテムを売る", 22 + xtra_stock, 30);
5066 prt("x) 商品を調べる", 23 + xtra_stock,30);
5068 prt("p) Purchase an item.", 21 + xtra_stock, 30);
5069 prt("s) Sell an item.", 22 + xtra_stock, 30);
5070 prt("x) eXamine an item in the shop", 23 + xtra_stock,30);
5077 prt("i/e) 持ち物/装備の一覧", 21 + xtra_stock, 56);
5079 if (rogue_like_commands)
5081 prt("w/T) 装備する/はずす", 22 + xtra_stock, 56);
5085 prt("w/t) 装備する/はずす", 22 + xtra_stock, 56);
5088 prt("i/e) Inventry/Equipment list", 21 + xtra_stock, 56);
5090 if (rogue_like_commands)
5092 prt("w/T) Wear/Take off equipment", 22 + xtra_stock, 56);
5096 prt("w/t) Wear/Take off equipment", 22 + xtra_stock, 56);
5101 prt("コマンド:", 20 + xtra_stock, 0);
5103 prt("You may: ", 20 + xtra_stock, 0);
5108 request_command(TRUE);
5110 /* Process the command */
5111 store_process_command();
5114 * Hack -- To redraw missiles damage and prices in store
5115 * If player's charisma changes, or if player changes a bow, PU_BONUS is set
5117 need_redraw_store_inv = (p_ptr->update & PU_BONUS) ? TRUE : FALSE;
5119 /* Hack -- Character is still in "icky" mode */
5120 character_icky = TRUE;
5128 /* XXX XXX XXX Pack Overflow */
5129 if (inventory[INVEN_PACK].k_idx)
5131 int item = INVEN_PACK;
5133 object_type *o_ptr = &inventory[item];
5135 /* Hack -- Flee from the store */
5136 if (cur_store_num != STORE_HOME)
5140 if (cur_store_num == STORE_MUSEUM)
5141 msg_print("ザックからアイテムがあふれそうなので、あわてて博物館から出た...");
5143 msg_print("ザックからアイテムがあふれそうなので、あわてて店から出た...");
5145 if (cur_store_num == STORE_MUSEUM)
5146 msg_print("Your pack is so full that you flee the Museum...");
5148 msg_print("Your pack is so full that you flee the store...");
5156 /* Hack -- Flee from the home */
5157 else if (!store_check_num(o_ptr))
5161 msg_print("ザックからアイテムがあふれそうなので、あわてて家から出た...");
5163 msg_print("Your pack is so full that you flee your home...");
5171 /* Hack -- Drop items into the home */
5179 char o_name[MAX_NLEN];
5182 /* Give a message */
5184 msg_print("ザックからアイテムがあふれてしまった!");
5186 msg_print("Your pack overflows!");
5190 /* Get local object */
5193 /* Grab a copy of the item */
5194 object_copy(q_ptr, o_ptr);
5197 object_desc(o_name, q_ptr, 0);
5201 msg_format("%sが落ちた。(%c)", o_name, index_to_label(item));
5203 msg_format("You drop %s (%c).", o_name, index_to_label(item));
5207 /* Remove it from the players inventory */
5208 inven_item_increase(item, -255);
5209 inven_item_describe(item);
5210 inven_item_optimize(item);
5215 /* Let the home carry it */
5216 item_pos = home_carry(q_ptr);
5218 /* Redraw the home */
5221 store_top = (item_pos / store_bottom) * store_bottom;
5222 display_inventory();
5227 /* Hack -- Redisplay store prices if charisma changes */
5228 /* Hack -- Redraw missiles damage if player changes bow */
5229 if (need_redraw_store_inv) display_inventory();
5231 /* Hack -- get kicked out of the store */
5232 if (st_ptr->store_open >= turn) leave_store = TRUE;
5235 select_floor_music();
5237 p_ptr->town_num = old_town_num;
5239 /* Free turn XXX XXX XXX */
5240 p_ptr->energy_use = 100;
5243 /* Hack -- Character is no longer in "icky" mode */
5244 character_icky = FALSE;
5247 /* Hack -- Cancel automatic command */
5250 /* Hack -- Cancel "see" mode */
5251 command_see = FALSE;
5253 /* Allow expanding macros */
5254 get_com_no_macros = FALSE;
5256 /* Flush messages XXX XXX XXX */
5260 /* Clear the screen */
5264 /* Update everything */
5265 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
5266 p_ptr->update |= (PU_MONSTERS);
5268 /* Redraw entire screen */
5269 p_ptr->redraw |= (PR_BASIC | PR_EXTRA | PR_EQUIPPY);
5272 p_ptr->redraw |= (PR_MAP);
5275 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5281 * @brief 現在の町の店主を交代させる /
5282 * Shuffle one of the stores.
5283 * @param which 店舗種類のID
5286 void store_shuffle(int which)
5292 if (which == STORE_HOME) return;
5293 if (which == STORE_MUSEUM) return;
5296 /* Save the store index */
5297 cur_store_num = which;
5299 /* Activate that store */
5300 st_ptr = &town[p_ptr->town_num].store[cur_store_num];
5303 /* Pick a new owner */
5306 st_ptr->owner = (byte)randint0(MAX_OWNERS);
5307 if (j == st_ptr->owner) continue;
5308 for (i = 1;i < max_towns; i++)
5310 if (i == p_ptr->town_num) continue;
5311 if (st_ptr->owner == town[i].store[cur_store_num].owner) break;
5313 if (i == max_towns) break;
5316 /* Activate the new owner */
5317 ot_ptr = &owners[cur_store_num][st_ptr->owner];
5320 /* Reset the owner data */
5321 st_ptr->insult_cur = 0;
5322 st_ptr->store_open = 0;
5323 st_ptr->good_buy = 0;
5324 st_ptr->bad_buy = 0;
5327 /* Hack -- discount all the items */
5328 for (i = 0; i < st_ptr->stock_num; i++)
5333 o_ptr = &st_ptr->stock[i];
5335 if (!object_is_artifact(o_ptr))
5337 /* Hack -- Sell all non-artifact old items for "half price" */
5338 o_ptr->discount = 50;
5340 /* Hack -- Items are no longer "fixed price" */
5341 o_ptr->ident &= ~(IDENT_FIXED);
5343 /* Mega-Hack -- Note that the item is "on sale" */
5345 o_ptr->inscription = quark_add("売出中");
5347 o_ptr->inscription = quark_add("on sale");
5355 * @brief 店の品揃えを変化させる /
5356 * Maintain the inventory at the stores.
5357 * @param town_num 町のID
5358 * @param store_num 店舗種類のID
5361 void store_maint(int town_num, int store_num)
5365 cur_store_num = store_num;
5368 if (store_num == STORE_HOME) return;
5369 if (store_num == STORE_MUSEUM) return;
5371 /* Activate that store */
5372 st_ptr = &town[town_num].store[store_num];
5374 /* Activate the owner */
5375 ot_ptr = &owners[store_num][st_ptr->owner];
5377 /* Store keeper forgives the player */
5378 st_ptr->insult_cur = 0;
5380 /* Mega-Hack -- prune the black market */
5381 if (store_num == STORE_BLACK)
5383 /* Destroy crappy black market items */
5384 for (j = st_ptr->stock_num - 1; j >= 0; j--)
5386 object_type *o_ptr = &st_ptr->stock[j];
5388 /* Destroy crappy items */
5389 if (black_market_crap(o_ptr))
5391 /* Destroy the item */
5392 store_item_increase(j, 0 - o_ptr->number);
5393 store_item_optimize(j);
5399 /* Choose the number of slots to keep */
5400 j = st_ptr->stock_num;
5402 /* Sell a few items */
5403 j = j - randint1(STORE_TURNOVER);
5405 /* Never keep more than "STORE_MAX_KEEP" slots */
5406 if (j > STORE_MAX_KEEP) j = STORE_MAX_KEEP;
5408 /* Always "keep" at least "STORE_MIN_KEEP" items */
5409 if (j < STORE_MIN_KEEP) j = STORE_MIN_KEEP;
5411 /* Hack -- prevent "underflow" */
5414 /* Destroy objects until only "j" slots are left */
5415 while (st_ptr->stock_num > j) store_delete();
5418 /* Choose the number of slots to fill */
5419 j = st_ptr->stock_num;
5421 /* Buy some more items */
5422 j = j + randint1(STORE_TURNOVER);
5424 /* Never keep more than "STORE_MAX_KEEP" slots */
5425 if (j > STORE_MAX_KEEP) j = STORE_MAX_KEEP;
5427 /* Always "keep" at least "STORE_MIN_KEEP" items */
5428 if (j < STORE_MIN_KEEP) j = STORE_MIN_KEEP;
5430 /* Hack -- prevent "overflow" */
5431 if (j >= st_ptr->stock_size) j = st_ptr->stock_size - 1;
5433 /* Acquire some new items */
5434 while (st_ptr->stock_num < j) store_create();
5439 * @brief 店舗情報を初期化する /
5440 * Initialize the stores
5441 * @param town_num 町のID
5442 * @param store_num 店舗種類のID
5445 void store_init(int town_num, int store_num)
5449 cur_store_num = store_num;
5451 /* Activate that store */
5452 st_ptr = &town[town_num].store[store_num];
5460 st_ptr->owner = (byte)randint0(MAX_OWNERS);
5461 for (i = 1;i < max_towns; i++)
5463 if (i == town_num) continue;
5464 if (st_ptr->owner == town[i].store[store_num].owner) break;
5466 if (i == max_towns) break;
5469 /* Activate the new owner */
5470 ot_ptr = &owners[store_num][st_ptr->owner];
5473 /* Initialize the store */
5474 st_ptr->store_open = 0;
5475 st_ptr->insult_cur = 0;
5476 st_ptr->good_buy = 0;
5477 st_ptr->bad_buy = 0;
5479 /* Nothing in stock */
5480 st_ptr->stock_num = 0;
5483 * MEGA-HACK - Last visit to store is
5484 * BEFORE player birth to enable store restocking
5486 st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
5488 /* Clear any old items */
5489 for (k = 0; k < st_ptr->stock_size; k++)
5491 object_wipe(&st_ptr->stock[k]);
5497 * @brief アイテムを町のブラックマーケットに移動させる /
5498 * @param o_ptr 移動させたいオブジェクトの構造体参照ポインタ
5501 void move_to_black_market(object_type *o_ptr)
5504 if (!p_ptr->town_num) return;
5506 st_ptr = &town[p_ptr->town_num].store[STORE_BLACK];
5508 o_ptr->ident |= IDENT_STORE;
5510 (void)store_carry(o_ptr);
5512 object_wipe(o_ptr); /* Don't leave a bogus object behind... */