OSDN Git Service

[Refactor] #40415 Moved *.c and *.h regarding monster spell from spell/ to mspell/
[hengband/hengband.git] / src / mspell / mspell-breath.c
1 #include "system/angband.h"
2 #include "mspell/mspell-breath.h"
3 #include "mspell/monster-spell.h"
4 #include "spell/spells-type.h"
5 #include "main/sound-definitions-table.h"
6 #include "mspell/mspell-util.h"
7 #include "mspell/mspell-damage-calculator.h"
8 #include "player/player-move.h"
9
10 /*!
11  * @brief RF4_BR_*の処理。各種ブレス。 /
12  * @param target_ptr プレーヤーへの参照ポインタ
13  * @param GF_TYPE ブレスの属性
14  * @param y 対象の地点のy座標
15  * @param x 対象の地点のx座標
16  * @param m_idx 呪文を唱えるモンスターID
17  * @param t_idx 呪文を受けるモンスターID。プレイヤーの場合はdummyで0とする。
18  * @param TARGET_TYPE プレイヤーを対象とする場合MONSTER_TO_PLAYER、モンスターを対象とする場合MONSTER_TO_MONSTER
19  * @return ダメージ量を返す。
20  */
21 HIT_POINT spell_RF4_BREATH(player_type* target_ptr, int GF_TYPE, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
22 {
23     HIT_POINT dam, ms_type, drs_type = 0;
24     concptr type_s;
25     bool smart_learn_aux = TRUE;
26     floor_type* floor_ptr = target_ptr->current_floor_ptr;
27     monster_type* m_ptr = &floor_ptr->m_list[m_idx];
28     bool known = monster_near_player(floor_ptr, m_idx, t_idx);
29     bool see_either = see_monster(target_ptr->current_floor_ptr, m_idx) || see_monster(target_ptr->current_floor_ptr, t_idx);
30     bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
31     bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
32     GAME_TEXT m_name[MAX_NLEN], t_name[MAX_NLEN];
33     monster_name(target_ptr, m_idx, m_name);
34     monster_name(target_ptr, t_idx, t_name);
35
36     switch (GF_TYPE) {
37     case GF_ACID:
38         dam = monspell_damage(target_ptr, (MS_BR_ACID), m_idx, DAM_ROLL);
39         type_s = _("酸", "acid");
40         ms_type = MS_BR_ACID;
41         drs_type = DRS_ACID;
42         break;
43     case GF_ELEC:
44         dam = monspell_damage(target_ptr, (MS_BR_ELEC), m_idx, DAM_ROLL);
45         type_s = _("稲妻", "lightning");
46         ms_type = MS_BR_ELEC;
47         drs_type = DRS_ELEC;
48         break;
49     case GF_FIRE:
50         dam = monspell_damage(target_ptr, (MS_BR_FIRE), m_idx, DAM_ROLL);
51         type_s = _("火炎", "fire");
52         ms_type = MS_BR_FIRE;
53         drs_type = DRS_FIRE;
54         break;
55     case GF_COLD:
56         dam = monspell_damage(target_ptr, (MS_BR_COLD), m_idx, DAM_ROLL);
57         type_s = _("冷気", "frost");
58         ms_type = MS_BR_COLD;
59         drs_type = DRS_COLD;
60         break;
61     case GF_POIS:
62         dam = monspell_damage(target_ptr, (MS_BR_POIS), m_idx, DAM_ROLL);
63         type_s = _("ガス", "gas");
64         ms_type = MS_BR_POIS;
65         drs_type = DRS_POIS;
66         break;
67     case GF_NETHER:
68         dam = monspell_damage(target_ptr, (MS_BR_NETHER), m_idx, DAM_ROLL);
69         type_s = _("地獄", "nether");
70         ms_type = MS_BR_NETHER;
71         drs_type = DRS_NETH;
72         break;
73     case GF_LITE:
74         dam = monspell_damage(target_ptr, (MS_BR_LITE), m_idx, DAM_ROLL);
75         type_s = _("閃光", "light");
76         ms_type = MS_BR_LITE;
77         drs_type = DRS_LITE;
78         break;
79     case GF_DARK:
80         dam = monspell_damage(target_ptr, (MS_BR_DARK), m_idx, DAM_ROLL);
81         type_s = _("暗黒", "darkness");
82         ms_type = MS_BR_DARK;
83         drs_type = DRS_DARK;
84         break;
85     case GF_CONFUSION:
86         dam = monspell_damage(target_ptr, (MS_BR_CONF), m_idx, DAM_ROLL);
87         type_s = _("混乱", "confusion");
88         ms_type = MS_BR_CONF;
89         drs_type = DRS_CONF;
90         break;
91     case GF_SOUND:
92         dam = monspell_damage(target_ptr, (MS_BR_SOUND), m_idx, DAM_ROLL);
93         type_s = _("轟音", "sound");
94         ms_type = MS_BR_SOUND;
95         drs_type = DRS_SOUND;
96         break;
97     case GF_CHAOS:
98         dam = monspell_damage(target_ptr, (MS_BR_CHAOS), m_idx, DAM_ROLL);
99         type_s = _("カオス", "chaos");
100         ms_type = MS_BR_CHAOS;
101         drs_type = DRS_CHAOS;
102         break;
103     case GF_DISENCHANT:
104         dam = monspell_damage(target_ptr, (MS_BR_DISEN), m_idx, DAM_ROLL);
105         type_s = _("劣化", "disenchantment");
106         ms_type = MS_BR_DISEN;
107         drs_type = DRS_DISEN;
108         break;
109     case GF_NEXUS:
110         dam = monspell_damage(target_ptr, (MS_BR_NEXUS), m_idx, DAM_ROLL);
111         type_s = _("因果混乱", "nexus");
112         ms_type = MS_BR_NEXUS;
113         drs_type = DRS_NEXUS;
114         break;
115     case GF_TIME:
116         dam = monspell_damage(target_ptr, (MS_BR_TIME), m_idx, DAM_ROLL);
117         type_s = _("時間逆転", "time");
118         ms_type = MS_BR_TIME;
119         smart_learn_aux = FALSE;
120         break;
121     case GF_INERTIAL:
122         dam = monspell_damage(target_ptr, (MS_BR_INERTIA), m_idx, DAM_ROLL);
123         type_s = _("遅鈍", "inertia");
124         ms_type = MS_BR_INERTIA;
125         smart_learn_aux = FALSE;
126         break;
127     case GF_GRAVITY:
128         dam = monspell_damage(target_ptr, (MS_BR_GRAVITY), m_idx, DAM_ROLL);
129         type_s = _("重力", "gravity");
130         ms_type = MS_BR_GRAVITY;
131         smart_learn_aux = FALSE;
132         break;
133     case GF_SHARDS:
134         dam = monspell_damage(target_ptr, (MS_BR_SHARDS), m_idx, DAM_ROLL);
135         type_s = _("破片", "shards");
136         ms_type = MS_BR_SHARDS;
137         drs_type = DRS_SHARD;
138         break;
139     case GF_PLASMA:
140         dam = monspell_damage(target_ptr, (MS_BR_PLASMA), m_idx, DAM_ROLL);
141         type_s = _("プラズマ", "plasma");
142         ms_type = MS_BR_PLASMA;
143         smart_learn_aux = FALSE;
144         break;
145     case GF_FORCE:
146         dam = monspell_damage(target_ptr, (MS_BR_FORCE), m_idx, DAM_ROLL);
147         type_s = _("フォース", "force");
148         ms_type = MS_BR_FORCE;
149         smart_learn_aux = FALSE;
150         break;
151     case GF_MANA:
152         dam = monspell_damage(target_ptr, (MS_BR_MANA), m_idx, DAM_ROLL);
153         type_s = _("魔力", "mana");
154         ms_type = MS_BR_MANA;
155         smart_learn_aux = FALSE;
156         break;
157     case GF_NUKE:
158         dam = monspell_damage(target_ptr, (MS_BR_NUKE), m_idx, DAM_ROLL);
159         type_s = _("放射性廃棄物", "toxic waste");
160         ms_type = MS_BR_NUKE;
161         drs_type = DRS_POIS;
162         break;
163     case GF_DISINTEGRATE:
164         dam = monspell_damage(target_ptr, (MS_BR_DISI), m_idx, DAM_ROLL);
165         type_s = _("分解", "disintegration");
166         ms_type = MS_BR_DISI;
167         smart_learn_aux = FALSE;
168         break;
169     default:
170         /* Do not reach here */
171         dam = 0;
172         type_s = _("不明", "Unknown");
173         ms_type = MS_BR_ACID;
174         smart_learn_aux = FALSE;
175         break;
176     }
177
178     if (mon_to_player || (mon_to_mon && known && see_either))
179         disturb(target_ptr, TRUE, TRUE);
180
181     if (m_ptr->r_idx == MON_JAIAN && GF_TYPE == GF_SOUND) {
182         msg_format(_("「ボォエ~~~~~~」", "'Booooeeeeee'"));
183     } else if (m_ptr->r_idx == MON_BOTEI && GF_TYPE == GF_SHARDS) {
184         msg_format(_("「ボ帝ビルカッター!!!」", "'Boty-Build cutter!!!'"));
185     } else if (target_ptr->blind) {
186         if (mon_to_player || (mon_to_mon && known && see_either))
187             msg_format(_("%^sが何かのブレスを吐いた。", "%^s breathes."), m_name);
188     } else {
189         if (mon_to_player) {
190             msg_format(_("%^sが%^sのブレスを吐いた。", "%^s breathes %^s."), m_name, type_s);
191         } else if (mon_to_mon && known && see_either) {
192             _(msg_format("%^sが%^sに%^sのブレスを吐いた。", m_name, t_name, type_s),
193                 msg_format("%^s breathes %^s at %^s.", m_name, type_s, t_name));
194         }
195     }
196
197     if (mon_to_mon && known && !see_either)
198         floor_ptr->monster_noise = TRUE;
199
200     sound(SOUND_BREATH);
201     breath(target_ptr, y, x, m_idx, GF_TYPE, dam, 0, TRUE, ms_type, TARGET_TYPE);
202     if (smart_learn_aux && mon_to_player)
203         update_smart_learn(target_ptr, m_idx, drs_type);
204
205     return dam;
206 }