OSDN Git Service

Merge pull request #1774 from habu1010/feature/refactor-weapon-skill-table
[hengbandforosx/hengbandosx.git] / src / view / display-lore-drops.cpp
1 #include "view/display-lore-drops.h"
2 #include "lore/lore-util.h"
3 #include "monster-race/race-flags1.h"
4 #include "util/bit-flags-calculator.h"
5
6 void display_monster_drop_quantity(lore_type *lore_ptr)
7 {
8     lore_ptr->drop_quantity = MAX(lore_ptr->drop_gold, lore_ptr->drop_item);
9     if (lore_ptr->drop_quantity == 1) {
10         hooked_roff(_("一つの", " a"));
11 #ifdef JP
12 #else
13         lore_ptr->sin = true;
14 #endif
15     } else if (lore_ptr->drop_quantity == 2) {
16         hooked_roff(_("一つか二つの", " one or two"));
17     } else {
18         hooked_roff(format(_(" %d 個までの", " up to %d"), lore_ptr->drop_quantity));
19     }
20 }
21
22 void display_monster_drop_quality(lore_type* lore_ptr)
23 {
24     if (lore_ptr->flags1 & RF1_DROP_GREAT) {
25         lore_ptr->drop_quality = _("特別な", " exceptional");
26     } else if (lore_ptr->flags1 & RF1_DROP_GOOD) {
27         lore_ptr->drop_quality = _("上質な", " good");
28 #ifdef JP
29 #else
30         lore_ptr->sin = false;
31 #endif
32     } else {
33         lore_ptr->drop_quality = nullptr;
34     }
35 }
36
37 void display_monster_drop_items(lore_type *lore_ptr)
38 {
39     if (lore_ptr->drop_item == 0)
40         return;
41
42 #ifdef JP
43 #else
44     if (lore_ptr->sin)
45         hooked_roff("n");
46
47     lore_ptr->sin = false;
48 #endif
49
50     if (lore_ptr->drop_quality != nullptr)
51         hooked_roff(lore_ptr->drop_quality);
52
53     hooked_roff(_("アイテム", " object"));
54 #ifdef JP
55 #else
56     if (lore_ptr->drop_quantity != 1)
57         hooked_roff("s");
58 #endif
59     lore_ptr->drop_quality = _("や", " or");
60 }
61
62 void display_monster_drop_golds(lore_type *lore_ptr)
63 {
64     auto is_item_only = lore_ptr->drop_gold == 0;
65     is_item_only |= any_bits(lore_ptr->flags1, RF1_DROP_GOOD);
66     is_item_only |= any_bits(lore_ptr->flags1, RF1_DROP_GREAT);
67     if (is_item_only)
68         return;
69
70 #ifdef JP
71 #else
72     if (lore_ptr->drop_quality == nullptr)
73         lore_ptr->sin = false;
74
75     if (lore_ptr->sin)
76         hooked_roff("n");
77
78     lore_ptr->sin = false;
79 #endif
80
81     if (lore_ptr->drop_quality != nullptr)
82         hooked_roff(lore_ptr->drop_quality);
83
84     hooked_roff(_("財宝", " treasure"));
85 #ifdef JP
86 #else
87     if (lore_ptr->drop_quantity != 1)
88         hooked_roff("s");
89 #endif
90 }
91
92 void display_monster_drops(lore_type *lore_ptr)
93 {
94     if ((lore_ptr->drop_gold == 0) && (lore_ptr->drop_item == 0))
95         return;
96
97     hooked_roff(format(_("%^sは", "%^s may carry"), Who::who(lore_ptr->msex)));
98 #ifdef JP
99 #else
100     lore_ptr->sin = false;
101 #endif
102
103     display_monster_drop_quantity(lore_ptr);
104     display_monster_drop_quality(lore_ptr);
105     display_monster_drop_items(lore_ptr);
106     display_monster_drop_golds(lore_ptr);
107     hooked_roff(_("を持っていることがある。", ".  "));
108 }