1 #include "store/say-comments.h"
2 #include "main/sound-definitions-table.h"
3 #include "main/sound-of-music.h"
4 #include "store/store-owner-comments.h"
5 #include "store/store-util.h"
6 #include "player-info/avatar.h"
7 #include "store/rumor.h"
8 #include "view/display-messages.h"
10 #define RUMOR_CHANCE 8
13 * @brief 取引成功時の店主のメッセージ処理 /
14 * ブラックマーケットのときは別のメッセージを出す
16 * @param player_ptr プレーヤーへの参照ポインタ
19 void say_comment_1(player_type *player_ptr)
22 if (cur_store_num == STORE_BLACK)
24 msg_print(comment_1_B[randint0(MAX_COMMENT_1)]);
28 msg_print(comment_1[randint0(MAX_COMMENT_1)]);
31 msg_print(comment_1[randint0(MAX_COMMENT_1)]);
34 if (one_in_(RUMOR_CHANCE))
36 msg_print(_("店主は耳うちした:", "The shopkeeper whispers something into your ear:"));
37 display_rumor(player_ptr, TRUE);
43 * @brief プレイヤーがアイテムを買う時の価格代案メッセージ処理 /
44 * Continue haggling (player is buying)
45 * @param value 店主の提示価格
46 * @param annoyed 店主のいらつき度
49 void say_comment_2(PRICE value, int annoyed)
52 sprintf(tmp_val, "%ld", (long)value);
56 msg_format(comment_2a[randint0(MAX_COMMENT_2A)], tmp_val);
61 if (cur_store_num == STORE_BLACK)
63 msg_format(comment_2b_B[randint0(MAX_COMMENT_2B)], tmp_val);
67 msg_format(comment_2b[randint0(MAX_COMMENT_2B)], tmp_val);
70 msg_format(comment_2b[randint0(MAX_COMMENT_2B)], tmp_val);
76 * @brief プレイヤーがアイテムを売る時の価格代案メッセージ処理 /
77 * ブラックマーケットのときは別のメッセージを出す
78 * Continue haggling (player is selling)
79 * @param value 店主の提示価格
80 * @param annoyed 店主のいらつき度
83 void say_comment_3(PRICE value, int annoyed)
86 sprintf(tmp_val, "%ld", (long)value);
89 msg_format(comment_3a[randint0(MAX_COMMENT_3A)], tmp_val);
94 if (cur_store_num == STORE_BLACK)
96 msg_format(comment_3b_B[randint0(MAX_COMMENT_3B)], tmp_val);
100 msg_format(comment_3b[randint0(MAX_COMMENT_3B)], tmp_val);
103 msg_format(comment_3b[randint0(MAX_COMMENT_3B)], tmp_val);
110 * @brief 店主がプレイヤーを追い出す時のメッセージ処理 /
111 * ブラックマーケットの時は別のメッセージを出す
112 * Kick 'da bum out. -RAK-
115 void say_comment_4(void)
118 if (cur_store_num == STORE_BLACK)
120 msg_print(comment_4a_B[randint0(MAX_COMMENT_4A)]);
121 msg_print(comment_4b_B[randint0(MAX_COMMENT_4B)]);
125 msg_print(comment_4a[randint0(MAX_COMMENT_4A)]);
126 msg_print(comment_4b[randint0(MAX_COMMENT_4B)]);
129 msg_print(comment_4a[randint0(MAX_COMMENT_4A)]);
130 msg_print(comment_4b[randint0(MAX_COMMENT_4B)]);
137 * @brief 店主がプレイヤーに取り合わない時のメッセージ処理 /
138 * ブラックマーケットの時は別のメッセージを出す
139 * You are insulting me
142 void say_comment_5(void)
145 if (cur_store_num == STORE_BLACK)
147 msg_print(comment_5_B[randint0(MAX_COMMENT_5)]);
151 msg_print(comment_5[randint0(MAX_COMMENT_5)]);
154 msg_print(comment_5[randint0(MAX_COMMENT_5)]);
161 * @brief 店主がプレイヤーの提示を理解できなかった時のメッセージ処理 /
162 * That makes no sense.
165 void say_comment_6(void)
167 msg_print(comment_6[randint0(MAX_COMMENT_6)]);
171 * @brief 店主が交渉を終えた際の反応を返す処理 /
172 * Let a shop-keeper React to a purchase
173 * @param price アイテムの取引額
174 * @param value アイテムの実際価値
175 * @param guess 店主が当初予想していた価値
178 * We paid "price", it was worth "value", and we thought it was worth "guess"
180 void purchase_analyze(player_type *player_ptr, PRICE price, PRICE value, PRICE guess)
182 /* Item was worthless, but we bought it */
183 if ((value <= 0) && (price > value))
185 msg_print(comment_7a[randint0(MAX_COMMENT_7A)]);
186 chg_virtue(player_ptr, V_HONOUR, -1);
187 chg_virtue(player_ptr, V_JUSTICE, -1);
192 /* Item was cheaper than we thought, and we paid more than necessary */
193 if ((value < guess) && (price > value))
195 msg_print(comment_7b[randint0(MAX_COMMENT_7B)]);
196 chg_virtue(player_ptr, V_JUSTICE, -1);
197 if (one_in_(4)) chg_virtue(player_ptr, V_HONOUR, -1);
202 /* Item was a good bargain, and we got away with it */
203 if ((value > guess) && (value < (4 * guess)) && (price < value))
205 msg_print(comment_7c[randint0(MAX_COMMENT_7C)]);
206 if (one_in_(4)) chg_virtue(player_ptr, V_HONOUR, -1);
207 else if (one_in_(4)) chg_virtue(player_ptr, V_HONOUR, 1);
212 /* Item was a great bargain, and we got away with it */
213 if ((value > guess) && (price < value))
215 msg_print(comment_7d[randint0(MAX_COMMENT_7D)]);
216 if (one_in_(2)) chg_virtue(player_ptr, V_HONOUR, -1);
217 if (one_in_(4)) chg_virtue(player_ptr, V_HONOUR, 1);
218 if (10 * price < value) chg_virtue(player_ptr, V_SACRIFICE, 1);