1 #include "store/say-comments.h"
2 #include "avatar/avatar.h"
3 #include "main/sound-definitions-table.h"
4 #include "main/sound-of-music.h"
5 #include "store/rumor.h"
6 #include "store/store-owner-comments.h"
7 #include "store/store-util.h"
8 #include "view/display-messages.h"
10 #define RUMOR_CHANCE 8
13 * @brief 取引成功時の店主のメッセージ処理 /
14 * ブラックマーケットのときは別のメッセージを出す
16 * @param player_ptr プレイヤーへの参照ポインタ
18 void store_owner_says_comment(PlayerType *player_ptr, StoreSaleType store_num)
20 if (store_num == StoreSaleType::BLACK) {
21 msg_print(comment_1_B[randint0(MAX_COMMENT_1)]);
23 msg_print(comment_1[randint0(MAX_COMMENT_1)]);
26 if (one_in_(RUMOR_CHANCE)) {
27 msg_print(_("店主は耳うちした:", "The shopkeeper whispers something into your ear:"));
28 display_rumor(player_ptr, true);
33 * @brief 店主が交渉を終えた際の反応を返す処理 /
34 * Let a shop-keeper React to a purchase
35 * @param price アイテムの取引額
36 * @param value アイテムの実際価値
37 * @param guess 店主が当初予想していた価値
39 * We paid "price", it was worth "value", and we thought it was worth "guess"
41 void purchase_analyze(PlayerType *player_ptr, PRICE price, PRICE value, PRICE guess)
43 /* Item was worthless, but we bought it */
44 if ((value <= 0) && (price > value)) {
45 msg_print(comment_7a[randint0(MAX_COMMENT_7A)]);
46 chg_virtue(player_ptr, V_HONOUR, -1);
47 chg_virtue(player_ptr, V_JUSTICE, -1);
52 /* Item was cheaper than we thought, and we paid more than necessary */
53 if ((value < guess) && (price > value)) {
54 msg_print(comment_7b[randint0(MAX_COMMENT_7B)]);
55 chg_virtue(player_ptr, V_JUSTICE, -1);
57 chg_virtue(player_ptr, V_HONOUR, -1);
63 /* Item was a good bargain, and we got away with it */
64 if ((value > guess) && (value < (4 * guess)) && (price < value)) {
65 msg_print(comment_7c[randint0(MAX_COMMENT_7C)]);
67 chg_virtue(player_ptr, V_HONOUR, -1);
68 } else if (one_in_(4)) {
69 chg_virtue(player_ptr, V_HONOUR, 1);
75 /* Item was a great bargain, and we got away with it */
76 if ((value > guess) && (price < value)) {
77 msg_print(comment_7d[randint0(MAX_COMMENT_7D)]);
79 chg_virtue(player_ptr, V_HONOUR, -1);
82 chg_virtue(player_ptr, V_HONOUR, 1);
84 if (10 * price < value) {
85 chg_virtue(player_ptr, V_SACRIFICE, 1);