OSDN Git Service

[WIP] [Refactor] #1787 オーラフラグをガワだけmonster_type/lore_type::aura_flags に分離した (このコミットでは動...
[hengbandforosx/hengbandosx.git] / src / player / player-damage.cpp
1 #include "player/player-damage.h"
2 #include "autopick/autopick-pref-processor.h"
3 #include "avatar/avatar.h"
4 #include "blue-magic/blue-magic-checker.h"
5 #include "cmd-io/cmd-process-screen.h"
6 #include "core/asking-player.h"
7 #include "core/disturbance.h"
8 #include "core/player-redraw-types.h"
9 #include "core/player-update-types.h"
10 #include "core/stuff-handler.h"
11 #include "core/window-redrawer.h"
12 #include "dungeon/dungeon.h"
13 #include "dungeon/quest.h"
14 #include "flavor/flavor-describer.h"
15 #include "flavor/object-flavor-types.h"
16 #include "floor/wild.h"
17 #include "game-option/birth-options.h"
18 #include "game-option/cheat-options.h"
19 #include "game-option/game-play-options.h"
20 #include "game-option/input-options.h"
21 #include "game-option/play-record-options.h"
22 #include "game-option/special-options.h"
23 #include "inventory/inventory-damage.h"
24 #include "inventory/inventory-slot-types.h"
25 #include "io/files-util.h"
26 #include "io/input-key-acceptor.h"
27 #include "io/report.h"
28 #include "io/write-diary.h"
29 #include "main/music-definitions-table.h"
30 #include "main/sound-definitions-table.h"
31 #include "main/sound-of-music.h"
32 #include "market/arena-info-table.h"
33 #include "mind/mind-mirror-master.h"
34 #include "monster-race/monster-race.h"
35 #include "monster-race/race-flags2.h"
36 #include "monster-race/race-flags3.h"
37 #include "monster/monster-describer.h"
38 #include "monster/monster-description-types.h"
39 #include "monster/monster-info.h"
40 #include "mutation/mutation-flag-types.h"
41 #include "object-enchant/tr-types.h"
42 #include "object-hook/hook-armor.h"
43 #include "object/item-tester-hooker.h"
44 #include "object/object-broken.h"
45 #include "object/object-flags.h"
46 #include "player-base/player-class.h"
47 #include "player-info/class-info.h"
48 #include "player-info/race-types.h"
49 #include "player-info/samurai-data-type.h"
50 #include "player/player-personality-types.h"
51 #include "player/player-status-flags.h"
52 #include "player/player-status-resist.h"
53 #include "player/player-status.h"
54 #include "player/race-info-table.h"
55 #include "player/special-defense-types.h"
56 #include "racial/racial-android.h"
57 #include "save/save.h"
58 #include "status/base-status.h"
59 #include "status/element-resistance.h"
60 #include "system/building-type-definition.h"
61 #include "system/floor-type-definition.h"
62 #include "system/monster-race-definition.h"
63 #include "system/monster-type-definition.h"
64 #include "system/object-type-definition.h"
65 #include "system/player-type-definition.h"
66 #include "term/screen-processor.h"
67 #include "term/term-color-types.h"
68 #include "util/bit-flags-calculator.h"
69 #include "util/string-processor.h"
70 #include "view/display-messages.h"
71 #include "world/world.h"
72
73 /*!
74  * @brief 酸攻撃による装備のAC劣化処理 /
75  * Acid has hit the player, attempt to affect some armor.
76  * @param 酸を浴びたキャラクタへの参照ポインタ
77  * @return 装備による軽減があったならTRUEを返す
78  * @details
79  * 免疫があったらそもそもこの関数は実行されない (確実に錆びない).
80  * Note that the "base armor" of an object never changes.
81  * If any armor is damaged (or resists), the player takes less damage.
82  */
83 static bool acid_minus_ac(player_type *player_ptr)
84 {
85     object_type *o_ptr = nullptr;
86     switch (randint1(7)) {
87     case 1:
88         o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND];
89         break;
90     case 2:
91         o_ptr = &player_ptr->inventory_list[INVEN_SUB_HAND];
92         break;
93     case 3:
94         o_ptr = &player_ptr->inventory_list[INVEN_BODY];
95         break;
96     case 4:
97         o_ptr = &player_ptr->inventory_list[INVEN_OUTER];
98         break;
99     case 5:
100         o_ptr = &player_ptr->inventory_list[INVEN_ARMS];
101         break;
102     case 6:
103         o_ptr = &player_ptr->inventory_list[INVEN_HEAD];
104         break;
105     case 7:
106         o_ptr = &player_ptr->inventory_list[INVEN_FEET];
107         break;
108     }
109
110     if ((o_ptr == nullptr) || (o_ptr->k_idx == 0) || !o_ptr->is_armour())
111         return false;
112
113     GAME_TEXT o_name[MAX_NLEN];
114     describe_flavor(player_ptr, o_name, o_ptr, OD_OMIT_PREFIX | OD_NAME_ONLY);
115     auto flgs = object_flags(o_ptr);
116     if (o_ptr->ac + o_ptr->to_a <= 0) {
117         msg_format(_("%sは既にボロボロだ!", "Your %s is already fully corroded!"), o_name);
118         return false;
119     }
120
121     if (flgs.has(TR_IGNORE_ACID)) {
122         msg_format(_("しかし%sには効果がなかった!", "Your %s is unaffected!"), o_name);
123         return true;
124     }
125
126     msg_format(_("%sが酸で腐食した!", "Your %s is corroded!"), o_name);
127     o_ptr->to_a--;
128     player_ptr->update |= PU_BONUS;
129     player_ptr->window_flags |= PW_EQUIP | PW_PLAYER;
130     calc_android_exp(player_ptr);
131     return true;
132 }
133
134 /*!
135  * @brief 酸属性によるプレイヤー損害処理 /
136  * Hurt the player with Acid
137  * @param player_ptr 酸を浴びたキャラクタへの参照ポインタ
138  * @param dam 基本ダメージ量
139  * @param kb_str ダメージ原因記述
140  * @param monspell 原因となったモンスター特殊攻撃ID
141  * @param aura オーラよるダメージが原因ならばTRUE
142  * @return 修正HPダメージ量
143  * @details 酸オーラは存在しないが関数ポインタのために引数だけは用意している
144  */
145 HIT_POINT acid_dam(player_type *player_ptr, HIT_POINT dam, concptr kb_str, bool aura)
146 {
147     int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
148     bool double_resist = is_oppose_acid(player_ptr);
149     dam = dam * calc_acid_damage_rate(player_ptr) / 100;
150     if (dam <= 0)
151         return 0;
152
153     if (aura || !check_multishadow(player_ptr)) {
154         if ((!(double_resist || has_resist_acid(player_ptr))) && one_in_(HURT_CHANCE))
155             (void)do_dec_stat(player_ptr, A_CHR);
156
157         if (acid_minus_ac(player_ptr))
158             dam = (dam + 1) / 2;
159     }
160
161     HIT_POINT get_damage = take_hit(player_ptr, aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str);
162     if (!aura && !(double_resist && has_resist_acid(player_ptr)))
163         inventory_damage(player_ptr, BreakerAcid(), inv);
164
165     return get_damage;
166 }
167
168 /*!
169  * @brief 電撃属性によるプレイヤー損害処理 /
170  * Hurt the player with electricity
171  * @param player_ptr 電撃を浴びたキャラクタへの参照ポインタ
172  * @param dam 基本ダメージ量
173  * @param kb_str ダメージ原因記述
174  * @param monspell 原因となったモンスター特殊攻撃ID
175  * @param aura オーラよるダメージが原因ならばTRUE
176  * @return 修正HPダメージ量
177  */
178 HIT_POINT elec_dam(player_type *player_ptr, HIT_POINT dam, concptr kb_str, bool aura)
179 {
180     int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
181     bool double_resist = is_oppose_elec(player_ptr);
182
183     dam = dam * calc_elec_damage_rate(player_ptr) / 100;
184
185     if (dam <= 0)
186         return 0;
187
188     if (aura || !check_multishadow(player_ptr)) {
189         if ((!(double_resist || has_resist_elec(player_ptr))) && one_in_(HURT_CHANCE))
190             (void)do_dec_stat(player_ptr, A_DEX);
191     }
192
193     HIT_POINT get_damage = take_hit(player_ptr, aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str);
194     if (!aura && !(double_resist && has_resist_elec(player_ptr)))
195         inventory_damage(player_ptr, BreakerElec(), inv);
196
197     return get_damage;
198 }
199
200 /*!
201  * @brief 火炎属性によるプレイヤー損害処理 /
202  * Hurt the player with Fire
203  * @param player_ptr 火炎を浴びたキャラクタへの参照ポインタ
204  * @param dam 基本ダメージ量
205  * @param kb_str ダメージ原因記述
206  * @param monspell 原因となったモンスター特殊攻撃ID
207  * @param aura オーラよるダメージが原因ならばTRUE
208  * @return 修正HPダメージ量
209  */
210 HIT_POINT fire_dam(player_type *player_ptr, HIT_POINT dam, concptr kb_str, bool aura)
211 {
212     int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
213     bool double_resist = is_oppose_fire(player_ptr);
214
215     /* Totally immune */
216     if (has_immune_fire(player_ptr) || (dam <= 0))
217         return 0;
218
219     dam = dam * calc_fire_damage_rate(player_ptr) / 100;
220     if (aura || !check_multishadow(player_ptr)) {
221         if ((!(double_resist || has_resist_fire(player_ptr))) && one_in_(HURT_CHANCE))
222             (void)do_dec_stat(player_ptr, A_STR);
223     }
224
225     HIT_POINT get_damage = take_hit(player_ptr, aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str);
226     if (!aura && !(double_resist && has_resist_fire(player_ptr)))
227         inventory_damage(player_ptr, BreakerFire(), inv);
228
229     return get_damage;
230 }
231
232 /*!
233  * @brief 冷気属性によるプレイヤー損害処理 /
234  * Hurt the player with Cold
235  * @param player_ptr 冷気を浴びたキャラクタへの参照ポインタ
236  * @param dam 基本ダメージ量
237  * @param kb_str ダメージ原因記述
238  * @param monspell 原因となったモンスター特殊攻撃ID
239  * @param aura オーラよるダメージが原因ならばTRUE
240  * @return 修正HPダメージ量
241  */
242 HIT_POINT cold_dam(player_type *player_ptr, HIT_POINT dam, concptr kb_str, bool aura)
243 {
244     int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
245     bool double_resist = is_oppose_cold(player_ptr);
246     if (has_immune_cold(player_ptr) || (dam <= 0))
247         return 0;
248
249     dam = dam * calc_cold_damage_rate(player_ptr) / 100;
250     if (aura || !check_multishadow(player_ptr)) {
251         if ((!(double_resist || has_resist_cold(player_ptr))) && one_in_(HURT_CHANCE))
252             (void)do_dec_stat(player_ptr, A_STR);
253     }
254
255     HIT_POINT get_damage = take_hit(player_ptr, aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str);
256     if (!aura && !(double_resist && has_resist_cold(player_ptr)))
257         inventory_damage(player_ptr, BreakerCold(), inv);
258
259     return get_damage;
260 }
261
262 /*
263  * Decreases players hit points and sets death flag if necessary
264  *
265  * Invulnerability needs to be changed into a "shield"
266  *
267  * Hack -- this function allows the user to save (or quit)
268  * the game when he dies, since the "You die." message is shown before
269  * setting the player to "dead".
270  */
271 int take_hit(player_type *player_ptr, int damage_type, HIT_POINT damage, concptr hit_from)
272 {
273     int old_chp = player_ptr->chp;
274
275     char death_message[1024];
276     char tmp[1024];
277
278     int warning = (player_ptr->mhp * hitpoint_warn / 10);
279     if (player_ptr->is_dead)
280         return 0;
281
282     if (player_ptr->sutemi)
283         damage *= 2;
284     if (PlayerClass(player_ptr).samurai_stance_is(SamuraiStance::IAI))
285         damage += (damage + 4) / 5;
286
287     if (damage_type != DAMAGE_USELIFE) {
288         disturb(player_ptr, true, true);
289         if (auto_more) {
290             player_ptr->now_damaged = true;
291         }
292     }
293
294     if ((damage_type != DAMAGE_USELIFE) && (damage_type != DAMAGE_LOSELIFE)) {
295         if (is_invuln(player_ptr) && (damage < 9000)) {
296             if (damage_type == DAMAGE_FORCE) {
297                 msg_print(_("バリアが切り裂かれた!", "The attack cuts your shield of invulnerability open!"));
298             } else if (one_in_(PENETRATE_INVULNERABILITY)) {
299                 msg_print(_("無敵のバリアを破って攻撃された!", "The attack penetrates your shield of invulnerability!"));
300             } else {
301                 return 0;
302             }
303         }
304
305         if (check_multishadow(player_ptr)) {
306             if (damage_type == DAMAGE_FORCE) {
307                 msg_print(_("幻影もろとも体が切り裂かれた!", "The attack hits Shadow together with you!"));
308             } else if (damage_type == DAMAGE_ATTACK) {
309                 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, but you are unharmed!"));
310                 return 0;
311             }
312         }
313
314         if (player_ptr->wraith_form) {
315             if (damage_type == DAMAGE_FORCE) {
316                 msg_print(_("半物質の体が切り裂かれた!", "The attack cuts through your ethereal body!"));
317             } else {
318                 damage /= 2;
319                 if ((damage == 0) && one_in_(2))
320                     damage = 1;
321             }
322         }
323
324         if (PlayerClass(player_ptr).samurai_stance_is(SamuraiStance::MUSOU)) {
325             damage /= 2;
326             if ((damage == 0) && one_in_(2))
327                 damage = 1;
328         }
329     }
330
331     player_ptr->chp -= damage;
332     if (player_ptr->chp < -9999)
333         player_ptr->chp = -9999;
334     if (damage_type == DAMAGE_GENO && player_ptr->chp < 0) {
335         damage += player_ptr->chp;
336         player_ptr->chp = 0;
337     }
338
339     player_ptr->redraw |= PR_HP;
340     player_ptr->window_flags |= PW_PLAYER;
341
342     if (damage_type != DAMAGE_GENO && player_ptr->chp == 0) {
343         chg_virtue(player_ptr, V_SACRIFICE, 1);
344         chg_virtue(player_ptr, V_CHANCE, 2);
345     }
346
347     if (player_ptr->chp < 0 && !cheat_immortal) {
348         bool android = player_ptr->prace == PlayerRaceType::ANDROID;
349
350         /* 死んだ時に強制終了して死を回避できなくしてみた by Habu */
351         if (!cheat_save && !save_player(player_ptr, SAVE_TYPE_CLOSE_GAME))
352             msg_print(_("セーブ失敗!", "death save failed!"));
353
354         sound(SOUND_DEATH);
355         chg_virtue(player_ptr, V_SACRIFICE, 10);
356         handle_stuff(player_ptr);
357         player_ptr->leaving = true;
358         if (!cheat_immortal)
359             player_ptr->is_dead = true;
360         if (player_ptr->current_floor_ptr->inside_arena) {
361             concptr m_name = r_info[arena_info[player_ptr->arena_number].r_idx].name.c_str();
362             msg_format(_("あなたは%sの前に敗れ去った。", "You are beaten by %s."), m_name);
363             msg_print(nullptr);
364             if (record_arena)
365                 exe_write_diary(player_ptr, DIARY_ARENA, -1 - player_ptr->arena_number, m_name);
366         } else {
367             QUEST_IDX q_idx = quest_number(player_ptr, player_ptr->current_floor_ptr->dun_level);
368             bool seppuku = streq(hit_from, "Seppuku");
369             bool winning_seppuku = w_ptr->total_winner && seppuku;
370
371             play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_GAMEOVER);
372
373 #ifdef WORLD_SCORE
374             screen_dump = make_screen_dump(player_ptr);
375 #endif
376             if (seppuku) {
377                 strcpy(player_ptr->died_from, hit_from);
378 #ifdef JP
379                 if (!winning_seppuku)
380                     strcpy(player_ptr->died_from, "切腹");
381 #endif
382             } else {
383                 char dummy[1024];
384 #ifdef JP
385                 sprintf(dummy, "%s%s%s",
386                     !player_ptr->paralyzed     ? ""
387                         : player_ptr->free_act ? "彫像状態で"
388                                                  : "麻痺状態で",
389                     player_ptr->hallucinated ? "幻覚に歪んだ" : "", hit_from);
390 #else
391                 sprintf(dummy, "%s%s", hit_from, !player_ptr->paralyzed ? "" : " while helpless");
392 #endif
393                 angband_strcpy(player_ptr->died_from, dummy, sizeof player_ptr->died_from);
394             }
395
396             w_ptr->total_winner = false;
397             if (winning_seppuku) {
398                 add_retired_class(player_ptr->pclass);
399                 exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, _("勝利の後切腹した。", "committed seppuku after the winning."));
400             } else {
401                 char buf[20];
402
403                 if (player_ptr->current_floor_ptr->inside_arena)
404                     strcpy(buf, _("アリーナ", "in the Arena"));
405                 else if (!is_in_dungeon(player_ptr))
406                     strcpy(buf, _("地上", "on the surface"));
407                 else if (q_idx && (quest_type::is_fixed(q_idx) && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
408                     strcpy(buf, _("クエスト", "in a quest"));
409                 else
410                     sprintf(buf, _("%d階", "level %d"), (int)player_ptr->current_floor_ptr->dun_level);
411
412                 sprintf(tmp, _("%sで%sに殺された。", "killed by %s %s."), buf, player_ptr->died_from);
413                 exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, tmp);
414             }
415
416             exe_write_diary(player_ptr, DIARY_GAMESTART, 1, _("-------- ゲームオーバー --------", "--------   Game  Over   --------"));
417             exe_write_diary(player_ptr, DIARY_DESCRIPTION, 1, "\n\n\n\n");
418             flush();
419             if (get_check_strict(player_ptr, _("画面を保存しますか?", "Dump the screen? "), CHECK_NO_HISTORY))
420                 do_cmd_save_screen(player_ptr);
421
422             flush();
423             if (player_ptr->last_message)
424                 string_free(player_ptr->last_message);
425
426             player_ptr->last_message = nullptr;
427             if (!last_words) {
428 #ifdef JP
429                 msg_format("あなたは%sました。", android ? "壊れ" : "死に");
430 #else
431                 msg_print(android ? "You are broken." : "You die.");
432 #endif
433
434                 msg_print(nullptr);
435             } else {
436                 if (winning_seppuku) {
437                     get_rnd_line(_("seppuku_j.txt", "seppuku.txt"), 0, death_message);
438                 } else {
439                     get_rnd_line(_("death_j.txt", "death.txt"), 0, death_message);
440                 }
441
442                 do {
443 #ifdef JP
444                     while (!get_string(winning_seppuku ? "辞世の句: " : "断末魔の叫び: ", death_message, sizeof(death_message)))
445                         ;
446 #else
447                     while (!get_string("Last words: ", death_message, 1024))
448                         ;
449 #endif
450                 } while (winning_seppuku && !get_check_strict(player_ptr, _("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY));
451
452                 if (death_message[0] == '\0') {
453 #ifdef JP
454                     strcpy(death_message, format("あなたは%sました。", android ? "壊れ" : "死に"));
455 #else
456                     strcpy(death_message, android ? "You are broken." : "You die.");
457 #endif
458                 } else
459                     player_ptr->last_message = string_make(death_message);
460
461 #ifdef JP
462                 if (winning_seppuku) {
463                     int i, len;
464                     int w = Term->wid;
465                     int h = Term->hgt;
466                     int msg_pos_x[9] = { 5, 7, 9, 12, 14, 17, 19, 21, 23 };
467                     int msg_pos_y[9] = { 3, 4, 5, 4, 5, 4, 5, 6, 4 };
468                     concptr str;
469                     char *str2;
470
471                     term_clear();
472
473                     /* 桜散る */
474                     for (i = 0; i < 40; i++)
475                         term_putstr(randint0(w / 2) * 2, randint0(h), 2, TERM_VIOLET, "υ");
476
477                     str = death_message;
478                     if (strncmp(str, "「", 2) == 0)
479                         str += 2;
480
481                     str2 = angband_strstr(str, "」");
482                     if (str2 != nullptr)
483                         *str2 = '\0';
484
485                     i = 0;
486                     while (i < 9) {
487                         str2 = angband_strstr(str, " ");
488                         if (str2 == nullptr)
489                             len = strlen(str);
490                         else
491                             len = str2 - str;
492
493                         if (len != 0) {
494                             term_putstr_v(w * 3 / 4 - 2 - msg_pos_x[i] * 2, msg_pos_y[i], len, TERM_WHITE, str);
495                             if (str2 == nullptr)
496                                 break;
497                             i++;
498                         }
499                         str = str2 + 1;
500                         if (*str == 0)
501                             break;
502                     }
503
504                     term_putstr(w - 1, h - 1, 1, TERM_WHITE, " ");
505                     flush();
506 #ifdef WORLD_SCORE
507                     screen_dump = make_screen_dump(player_ptr);
508 #endif
509                     (void)inkey();
510                 } else
511 #endif
512                     msg_print(death_message);
513             }
514         }
515
516         return damage;
517     }
518
519     handle_stuff(player_ptr);
520     if (player_ptr->chp < warning) {
521         if (old_chp > warning)
522             bell();
523
524         sound(SOUND_WARN);
525         if (record_danger && (old_chp > warning)) {
526             if (player_ptr->hallucinated && damage_type == DAMAGE_ATTACK)
527                 hit_from = _("何か", "something");
528
529             sprintf(tmp, _("%sによってピンチに陥った。", "was in a critical situation because of %s."), hit_from);
530             exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, tmp);
531         }
532
533         if (auto_more)
534             player_ptr->now_damaged = true;
535
536         msg_print(_("*** 警告:低ヒット・ポイント! ***", "*** LOW HITPOINT WARNING! ***"));
537         msg_print(nullptr);
538         flush();
539     }
540
541     if (player_ptr->wild_mode && !player_ptr->leaving && (player_ptr->chp < std::max(warning, player_ptr->mhp / 5)))
542         change_wild_mode(player_ptr, false);
543
544     return damage;
545 }
546
547 /*!
548  * @brief 属性に応じた敵オーラによるプレイヤーのダメージ処理
549  * @param m_ptr オーラを持つモンスターの構造体参照ポインタ
550  * @param immune ダメージを回避できる免疫フラグ
551  * @param flags_offset オーラフラグ配列の参照オフセット
552  * @param r_flags_offset モンスターの耐性配列の参照オフセット
553  * @param aura_flag オーラフラグ配列
554  * @param dam_func ダメージ処理を行う関数の参照ポインタ
555  * @param message オーラダメージを受けた際のメッセージ
556  */
557 static void process_aura_damage(monster_type *m_ptr, player_type *player_ptr, bool immune, int flags_offset, int r_flags_offset, uint32_t aura_flag,
558     HIT_POINT (*dam_func)(player_type *player_ptr, HIT_POINT dam, concptr kb_str, bool aura), concptr message)
559 {
560     monster_race *r_ptr = &r_info[m_ptr->r_idx];
561     if (!(atoffset(BIT_FLAGS, r_ptr, flags_offset) & aura_flag) || immune)
562         return;
563
564     GAME_TEXT mon_name[MAX_NLEN];
565     int aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
566
567     monster_desc(player_ptr, mon_name, m_ptr, MD_WRONGDOER_NAME);
568     msg_print(message);
569     dam_func(player_ptr, aura_damage, mon_name, true);
570
571     if (is_original_ap_and_seen(player_ptr, m_ptr))
572         atoffset(BIT_FLAGS, r_ptr, r_flags_offset) |= aura_flag;
573
574     handle_stuff(player_ptr);
575 }
576
577 /*!
578  * @brief 敵オーラによるプレイヤーのダメージ処理
579  * @param m_ptr オーラを持つモンスターの構造体参照ポインタ
580  * @param player_ptr プレイヤーへの参照ポインタ
581  */
582 void touch_zap_player(monster_type *m_ptr, player_type *player_ptr)
583 {
584     process_aura_damage(m_ptr, player_ptr, (bool)has_immune_fire(player_ptr), offsetof(monster_race, flags2), offsetof(monster_race, r_flags2), RF2_XX14,
585         fire_dam, _("突然とても熱くなった!", "You are suddenly very hot!"));
586     process_aura_damage(m_ptr, player_ptr, (bool)has_immune_cold(player_ptr), offsetof(monster_race, flags3), offsetof(monster_race, r_flags3), RF3_XX10,
587         cold_dam, _("突然とても寒くなった!", "You are suddenly very cold!"));
588     process_aura_damage(m_ptr, player_ptr, (bool)has_immune_elec(player_ptr), offsetof(monster_race, flags2), offsetof(monster_race, r_flags2), RF2_XX15,
589         elec_dam, _("電撃をくらった!", "You get zapped!"));
590 }