OSDN Git Service

Merge pull request #753 from iks3/fix-low-magic-down-saving
[hengbandforosx/hengbandosx.git] / src / racial / racial-draconian.cpp
1 #include "racial/racial-draconian.h"
2 #include "mind/mind-elementalist.h"
3 #include "spell-kind/spells-launcher.h"
4 #include "spell/spell-types.h"
5 #include "target/target-getter.h"
6 #include "view/display-messages.h"
7
8 static void decide_breath_kind(player_type *creature_ptr, int *breath_type, concptr *breath_type_description)
9 {
10     if (randint1(100) >= creature_ptr->lev)
11         return;
12
13     switch (creature_ptr->pclass) {
14     case CLASS_WARRIOR:
15     case CLASS_BERSERKER:
16     case CLASS_RANGER:
17     case CLASS_TOURIST:
18     case CLASS_IMITATOR:
19     case CLASS_ARCHER:
20     case CLASS_SMITH:
21         if (one_in_(3)) {
22             *breath_type = GF_MISSILE;
23             *breath_type_description = _("エレメント", "the elements");
24         } else {
25             *breath_type = GF_SHARDS;
26             *breath_type_description = _("破片", "shards");
27         }
28
29         break;
30     case CLASS_MAGE:
31     case CLASS_WARRIOR_MAGE:
32     case CLASS_HIGH_MAGE:
33     case CLASS_SORCERER:
34     case CLASS_MAGIC_EATER:
35     case CLASS_RED_MAGE:
36     case CLASS_BLUE_MAGE:
37     case CLASS_MIRROR_MASTER:
38         if (one_in_(3)) {
39             *breath_type = GF_MANA;
40             *breath_type_description = _("魔力", "mana");
41         } else {
42             *breath_type = GF_DISENCHANT;
43             *breath_type_description = _("劣化", "disenchantment");
44         }
45
46         break;
47     case CLASS_CHAOS_WARRIOR:
48         if (!one_in_(3)) {
49             *breath_type = GF_CONFUSION;
50             *breath_type_description = _("混乱", "confusion");
51         } else {
52             *breath_type = GF_CHAOS;
53             *breath_type_description = _("カオス", "chaos");
54         }
55
56         break;
57     case CLASS_MONK:
58     case CLASS_SAMURAI:
59     case CLASS_FORCETRAINER:
60         if (!one_in_(3)) {
61             *breath_type = GF_CONFUSION;
62             *breath_type_description = _("混乱", "confusion");
63         } else {
64             *breath_type = GF_SOUND;
65             *breath_type_description = _("轟音", "sound");
66         }
67
68         break;
69     case CLASS_MINDCRAFTER:
70         if (!one_in_(3)) {
71             *breath_type = GF_CONFUSION;
72             *breath_type_description = _("混乱", "confusion");
73         } else {
74             *breath_type = GF_PSI;
75             *breath_type_description = _("精神エネルギー", "mental energy");
76         }
77
78         break;
79     case CLASS_PRIEST:
80     case CLASS_PALADIN:
81         if (one_in_(3)) {
82             *breath_type = GF_HELL_FIRE;
83             *breath_type_description = _("地獄の劫火", "hellfire");
84         } else {
85             *breath_type = GF_HOLY_FIRE;
86             *breath_type_description = _("聖なる炎", "holy fire");
87         }
88
89         break;
90     case CLASS_ROGUE:
91     case CLASS_NINJA:
92         if (one_in_(3)) {
93             *breath_type = GF_DARK;
94             *breath_type_description = _("暗黒", "darkness");
95         } else {
96             *breath_type = GF_POIS;
97             *breath_type_description = _("毒", "poison");
98         }
99
100         break;
101     case CLASS_BARD:
102         if (!one_in_(3)) {
103             *breath_type = GF_SOUND;
104             *breath_type_description = _("轟音", "sound");
105         } else {
106             *breath_type = GF_CONFUSION;
107             *breath_type_description = _("混乱", "confusion");
108         }
109
110         break;
111     case CLASS_ELEMENTALIST:
112         *breath_type = get_element_type(creature_ptr->realm1, 0);
113         *breath_type_description = get_element_name(creature_ptr->realm1, 0);
114         break;
115     default:
116         break;
117     }
118 }
119
120 bool draconian_breath(player_type *creature_ptr)
121 {
122     int breath_type = (one_in_(3) ? GF_COLD : GF_FIRE);
123     concptr breath_type_description = ((breath_type == GF_COLD) ? _("冷気", "cold") : _("炎", "fire"));
124     DIRECTION dir;
125     if (!get_aim_dir(creature_ptr, &dir))
126         return FALSE;
127
128     decide_breath_kind(creature_ptr, &breath_type, &breath_type_description);
129     stop_mouth(creature_ptr);
130     msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), breath_type_description);
131
132     fire_breath(creature_ptr, breath_type, dir, creature_ptr->lev * 2, (creature_ptr->lev / 15) + 1);
133     return TRUE;
134 }