OSDN Git Service

b81378edebf39f4fd13b53daadc34e34ba9c9430
[hengbandforosx/hengbandosx.git] / src / player-info / alignment.cpp
1 #include "player-info/alignment.h"
2 #include "game-option/text-display-options.h"
3 #include "system/player-type-definition.h"
4
5 PlayerAlignment::PlayerAlignment(player_type *creature_ptr)
6 {
7     this->creature_ptr = creature_ptr;
8 }
9
10 /*!
11  * @brief クリーチャーの抽象的善悪アライメントの表記名のみを返す。 / Return only alignment title
12  * @param creature_ptr 算出するクリーチャーの参照ポインタ。
13  * @return アライメントの表記名
14  */
15 concptr PlayerAlignment::alignment_label()
16 {
17     if (this->creature_ptr->alignment > 150)
18         return _("大善", "Lawful");
19     else if (this->creature_ptr->alignment > 50)
20         return _("中善", "Good");
21     else if (this->creature_ptr->alignment > 10)
22         return _("小善", "Neutral Good");
23     else if (this->creature_ptr->alignment > -11)
24         return _("中立", "Neutral");
25     else if (this->creature_ptr->alignment > -51)
26         return _("小悪", "Neutral Evil");
27     else if (this->creature_ptr->alignment > -151)
28         return _("中悪", "Evil");
29     else
30         return _("大悪", "Chaotic");
31 }
32
33 /*!
34  * @brief クリーチャーの抽象的善悪アライメントの表記を返す。 / Return alignment title
35  * @param creature_ptr 算出するクリーチャーの参照ポインタ。
36  * @return アライメントの表記を返す。
37  */
38 concptr PlayerAlignment::get_alignment_description(bool with_value)
39 {
40     auto s = alignment_label();
41     if (with_value || show_actual_value)
42         return format(_("%s(%ld)", "%s (%ld)"), s, static_cast<long>(this->creature_ptr->alignment));
43
44     return s;
45 }