OSDN Git Service

[Refactor] #2807 Renamed monster-race-definition.h to monster-race-info.h
[hengbandforosx/hengbandosx.git] / src / realm / realm-hissatsu.cpp
1 #include "realm/realm-hissatsu.h"
2 #include "artifact/fixed-art-types.h"
3 #include "cmd-action/cmd-attack.h"
4 #include "cmd-action/cmd-spell.h"
5 #include "cmd-item/cmd-throw.h"
6 #include "combat/combat-options-type.h"
7 #include "core/asking-player.h"
8 #include "core/player-redraw-types.h"
9 #include "core/player-update-types.h"
10 #include "core/stuff-handler.h"
11 #include "dungeon/dungeon-flag-types.h"
12 #include "effect/attribute-types.h"
13 #include "effect/effect-characteristics.h"
14 #include "effect/effect-processor.h"
15 #include "effect/spells-effect-util.h"
16 #include "floor/cave.h"
17 #include "floor/geometry.h"
18 #include "grid/feature-flag-types.h"
19 #include "grid/feature.h"
20 #include "grid/grid.h"
21 #include "inventory/inventory-slot-types.h"
22 #include "io/input-key-acceptor.h"
23 #include "io/input-key-requester.h"
24 #include "mind/mind-ninja.h"
25 #include "monster-race/monster-race-hook.h"
26 #include "monster-race/monster-race.h"
27 #include "monster-race/race-flags7.h"
28 #include "monster/monster-describer.h"
29 #include "monster/monster-info.h"
30 #include "monster/monster-update.h"
31 #include "object-enchant/tr-types.h"
32 #include "object/object-flags.h"
33 #include "player-info/equipment-info.h"
34 #include "player/player-damage.h"
35 #include "player/player-move.h"
36 #include "spell-kind/earthquake.h"
37 #include "spell-kind/spells-detection.h"
38 #include "spell-kind/spells-launcher.h"
39 #include "spell-kind/spells-perception.h"
40 #include "spell-kind/spells-sight.h"
41 #include "spell-kind/spells-teleport.h"
42 #include "spell/technic-info-table.h"
43 #include "status/bad-status-setter.h"
44 #include "system/dungeon-info.h"
45 #include "system/floor-type-definition.h"
46 #include "system/grid-type-definition.h"
47 #include "system/item-entity.h"
48 #include "system/monster-race-info.h"
49 #include "system/monster-type-definition.h"
50 #include "system/player-type-definition.h"
51 #include "target/grid-selector.h"
52 #include "target/projection-path-calculator.h"
53 #include "target/target-getter.h"
54 #include "term/screen-processor.h"
55 #include "timed-effect/player-cut.h"
56 #include "timed-effect/timed-effects.h"
57 #include "util/bit-flags-calculator.h"
58 #include "view/display-messages.h"
59 #include "world/world.h"
60
61 /*!
62  * @brief 剣術の各処理を行う
63  * @param player_ptr プレイヤーへの参照ポインタ
64  * @param spell 剣術ID
65  * @param mode 処理内容 (SpellProcessType::NAME / SPELL_DESC / SpellProcessType::CAST)
66  * @return SpellProcessType::NAME / SPELL_DESC 時には文字列ポインタを返す。SpellProcessType::CAST時はnullptr文字列を返す。
67  */
68 concptr do_hissatsu_spell(PlayerType *player_ptr, SPELL_IDX spell, SpellProcessType mode)
69 {
70     bool name = mode == SpellProcessType::NAME;
71     bool desc = mode == SpellProcessType::DESCRIPTION;
72     bool cast = mode == SpellProcessType::CAST;
73
74     DIRECTION dir;
75     PLAYER_LEVEL plev = player_ptr->lev;
76
77     switch (spell) {
78     case 0:
79         if (name) {
80             return _("飛飯綱", "Tobi-Izuna");
81         }
82         if (desc) {
83             return _("2マス離れたところにいるモンスターを攻撃する。", "Attacks a monster two squares away.");
84         }
85
86         if (cast) {
87             project_length = 2;
88             if (!get_aim_dir(player_ptr, &dir)) {
89                 return nullptr;
90             }
91
92             project_hook(player_ptr, AttributeType::ATTACK, dir, HISSATSU_2, PROJECT_STOP | PROJECT_KILL);
93         }
94         break;
95
96     case 1:
97         if (name) {
98             return _("五月雨斬り", "3-Way Attack");
99         }
100         if (desc) {
101             return _("3方向に対して攻撃する。", "Attacks in 3 directions at one time.");
102         }
103
104         if (cast) {
105             DIRECTION cdir;
106             POSITION y, x;
107
108             if (!get_direction(player_ptr, &dir, false, false)) {
109                 return nullptr;
110             }
111             if (dir == 5) {
112                 return nullptr;
113             }
114
115             for (cdir = 0; cdir < 8; cdir++) {
116                 if (cdd[cdir] == dir) {
117                     break;
118                 }
119             }
120
121             if (cdir == 8) {
122                 return nullptr;
123             }
124
125             y = player_ptr->y + ddy_cdd[cdir];
126             x = player_ptr->x + ddx_cdd[cdir];
127             if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
128                 do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
129             } else {
130                 msg_print(_("攻撃は空を切った。", "You attack the empty air."));
131             }
132
133             y = player_ptr->y + ddy_cdd[(cdir + 7) % 8];
134             x = player_ptr->x + ddx_cdd[(cdir + 7) % 8];
135             if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
136                 do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
137             } else {
138                 msg_print(_("攻撃は空を切った。", "You attack the empty air."));
139             }
140
141             y = player_ptr->y + ddy_cdd[(cdir + 1) % 8];
142             x = player_ptr->x + ddx_cdd[(cdir + 1) % 8];
143             if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
144                 do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
145             } else {
146                 msg_print(_("攻撃は空を切った。", "You attack the empty air."));
147             }
148         }
149         break;
150
151     case 2:
152         if (name) {
153             return _("ブーメラン", "Boomerang");
154         }
155         if (desc) {
156             return _(
157                 "武器を手元に戻ってくるように投げる。戻ってこないこともある。", "Throws current weapon. It'll return to your hand unless the action failed.");
158         }
159
160         if (cast) {
161             if (!ThrowCommand(player_ptr).do_cmd_throw(1, true, -1)) {
162                 return nullptr;
163             }
164         }
165         break;
166
167     case 3:
168         if (name) {
169             return _("焔霊", "Burning Strike");
170         }
171         if (desc) {
172             return _("火炎耐性のないモンスターに大ダメージを与える。", "Attacks a monster with more damage unless it has resistance to fire.");
173         }
174
175         if (cast) {
176             POSITION y, x;
177
178             if (!get_direction(player_ptr, &dir, false, false)) {
179                 return nullptr;
180             }
181             if (dir == 5) {
182                 return nullptr;
183             }
184
185             y = player_ptr->y + ddy[dir];
186             x = player_ptr->x + ddx[dir];
187
188             if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
189                 do_cmd_attack(player_ptr, y, x, HISSATSU_FIRE);
190             } else {
191                 msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
192                 return nullptr;
193             }
194         }
195         break;
196
197     case 4:
198         if (name) {
199             return _("殺気感知", "Detect Ferocity");
200         }
201         if (desc) {
202             return _("近くの思考することができるモンスターを感知する。", "Detects all monsters except the mindless in your vicinity.");
203         }
204
205         if (cast) {
206             detect_monsters_mind(player_ptr, DETECT_RAD_DEFAULT);
207         }
208         break;
209
210     case 5:
211         if (name) {
212             return _("みね打ち", "Strike to Stun");
213         }
214         if (desc) {
215             return _("相手にダメージを与えないが、朦朧とさせる。", "Attempts to stun a monster next to you.");
216         }
217
218         if (cast) {
219             POSITION y, x;
220
221             if (!get_direction(player_ptr, &dir, false, false)) {
222                 return nullptr;
223             }
224             if (dir == 5) {
225                 return nullptr;
226             }
227
228             y = player_ptr->y + ddy[dir];
229             x = player_ptr->x + ddx[dir];
230
231             if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
232                 do_cmd_attack(player_ptr, y, x, HISSATSU_MINEUCHI);
233             } else {
234                 msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
235                 return nullptr;
236             }
237         }
238         break;
239
240     case 6:
241         if (name) {
242             return _("カウンター", "Counter");
243         }
244         if (desc) {
245             return _("相手に攻撃されたときに反撃する。反撃するたびにMPを消費。",
246                 "Prepares to counterattack. When attacked by a monster, strikes back using SP each time.");
247         }
248
249         if (cast) {
250             if (player_ptr->riding) {
251                 msg_print(_("乗馬中には無理だ。", "You cannot do it when riding."));
252                 return nullptr;
253             }
254             msg_print(_("相手の攻撃に対して身構えた。", "You prepare to counterattack."));
255             player_ptr->counter = true;
256         }
257         break;
258
259     case 7:
260         if (name) {
261             return _("払い抜け", "Harainuke");
262         }
263         if (desc) {
264             return _("攻撃した後、反対側に抜ける。",
265                 "In one action, attacks a monster with your weapons normally and then moves to the space beyond the monster if that space is not blocked.");
266         }
267
268         if (cast) {
269             POSITION y, x;
270
271             if (player_ptr->riding) {
272                 msg_print(_("乗馬中には無理だ。", "You cannot do it when riding."));
273                 return nullptr;
274             }
275
276             if (!get_direction(player_ptr, &dir, false, false)) {
277                 return nullptr;
278             }
279
280             if (dir == 5) {
281                 return nullptr;
282             }
283             y = player_ptr->y + ddy[dir];
284             x = player_ptr->x + ddx[dir];
285
286             if (!player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
287                 msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
288                 return nullptr;
289             }
290
291             do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
292
293             if (!player_can_enter(player_ptr, player_ptr->current_floor_ptr->grid_array[y][x].feat, 0) || is_trap(player_ptr, player_ptr->current_floor_ptr->grid_array[y][x].feat)) {
294                 break;
295             }
296
297             y += ddy[dir];
298             x += ddx[dir];
299
300             if (player_can_enter(player_ptr, player_ptr->current_floor_ptr->grid_array[y][x].feat, 0) && !is_trap(player_ptr, player_ptr->current_floor_ptr->grid_array[y][x].feat) && !player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
301                 msg_print(nullptr);
302                 (void)move_player_effect(player_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
303             }
304         }
305         break;
306
307     case 8:
308         if (name) {
309             return _("サーペンツタン", "Serpent's Tongue");
310         }
311         if (desc) {
312             return _("毒耐性のないモンスターに大ダメージを与える。", "Attacks a monster with more damage unless it has resistance to poison.");
313         }
314
315         if (cast) {
316             POSITION y, x;
317
318             if (!get_direction(player_ptr, &dir, false, false)) {
319                 return nullptr;
320             }
321             if (dir == 5) {
322                 return nullptr;
323             }
324
325             y = player_ptr->y + ddy[dir];
326             x = player_ptr->x + ddx[dir];
327
328             if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
329                 do_cmd_attack(player_ptr, y, x, HISSATSU_POISON);
330             } else {
331                 msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
332                 return nullptr;
333             }
334         }
335         break;
336
337     case 9:
338         if (name) {
339             return _("斬魔剣弐の太刀", "Zammaken");
340         }
341         if (desc) {
342             return _("生命のない邪悪なモンスターに大ダメージを与えるが、他のモンスターには全く効果がない。",
343                 "Attacks an evil unliving monster with great damage. Has no effect on other monsters.");
344         }
345
346         if (cast) {
347             POSITION y, x;
348
349             if (!get_direction(player_ptr, &dir, false, false)) {
350                 return nullptr;
351             }
352             if (dir == 5) {
353                 return nullptr;
354             }
355
356             y = player_ptr->y + ddy[dir];
357             x = player_ptr->x + ddx[dir];
358
359             if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
360                 do_cmd_attack(player_ptr, y, x, HISSATSU_ZANMA);
361             } else {
362                 msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
363                 return nullptr;
364             }
365         }
366         break;
367
368     case 10:
369         if (name) {
370             return _("裂風剣", "Wind Blast");
371         }
372         if (desc) {
373             return _("攻撃した相手を後方へ吹き飛ばす。", "Attacks an adjacent monster and blows it away.");
374         }
375
376         if (cast) {
377             POSITION y, x;
378
379             if (!get_direction(player_ptr, &dir, false, false)) {
380                 return nullptr;
381             }
382             if (dir == 5) {
383                 return nullptr;
384             }
385
386             y = player_ptr->y + ddy[dir];
387             x = player_ptr->x + ddx[dir];
388
389             if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
390                 do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
391             } else {
392                 msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
393                 return nullptr;
394             }
395             if (dungeons_info[player_ptr->dungeon_idx].flags.has(DungeonFeatureType::NO_MELEE)) {
396                 return "";
397             }
398             if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
399                 int i;
400                 POSITION ty = y, tx = x;
401                 POSITION oy = y, ox = x;
402                 MONSTER_IDX m_idx = player_ptr->current_floor_ptr->grid_array[y][x].m_idx;
403                 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
404                 GAME_TEXT m_name[MAX_NLEN];
405
406                 monster_desc(player_ptr, m_name, m_ptr, 0);
407
408                 for (i = 0; i < 5; i++) {
409                     y += ddy[dir];
410                     x += ddx[dir];
411                     if (is_cave_empty_bold(player_ptr, y, x)) {
412                         ty = y;
413                         tx = x;
414                     } else {
415                         break;
416                     }
417                 }
418                 if ((ty != oy) || (tx != ox)) {
419                     msg_format(_("%sを吹き飛ばした!", "You blow %s away!"), m_name);
420                     player_ptr->current_floor_ptr->grid_array[oy][ox].m_idx = 0;
421                     player_ptr->current_floor_ptr->grid_array[ty][tx].m_idx = m_idx;
422                     m_ptr->fy = ty;
423                     m_ptr->fx = tx;
424
425                     update_monster(player_ptr, m_idx, true);
426                     lite_spot(player_ptr, oy, ox);
427                     lite_spot(player_ptr, ty, tx);
428
429                     if (monraces_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK)) {
430                         player_ptr->update |= (PU_MON_LITE);
431                     }
432                 }
433             }
434         }
435         break;
436
437     case 11:
438         if (name) {
439             return _("刀匠の目利き", "Judge");
440         }
441         if (desc) {
442             return _("武器・防具を1つ識別する。レベル45以上で武器・防具の能力を完全に知ることができる。",
443                 "Identifies a weapon or armor. *Identifies* the item at level 45.");
444         }
445
446         if (cast) {
447             if (plev > 44) {
448                 if (!identify_fully(player_ptr, true)) {
449                     return nullptr;
450                 }
451             } else {
452                 if (!ident_spell(player_ptr, true)) {
453                     return nullptr;
454                 }
455             }
456         }
457         break;
458
459     case 12:
460         if (name) {
461             return _("破岩斬", "Rock Smash");
462         }
463         if (desc) {
464             return _("岩を壊し、岩石系のモンスターに大ダメージを与える。", "Breaks rock or greatly damages a monster made of rocks.");
465         }
466
467         if (cast) {
468             POSITION y, x;
469
470             if (!get_direction(player_ptr, &dir, false, false)) {
471                 return nullptr;
472             }
473             if (dir == 5) {
474                 return nullptr;
475             }
476
477             y = player_ptr->y + ddy[dir];
478             x = player_ptr->x + ddx[dir];
479
480             if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
481                 do_cmd_attack(player_ptr, y, x, HISSATSU_HAGAN);
482             }
483
484             if (!cave_has_flag_bold(player_ptr->current_floor_ptr, y, x, TerrainCharacteristics::HURT_ROCK)) {
485                 break;
486             }
487
488             /* Destroy the feature */
489             cave_alter_feat(player_ptr, y, x, TerrainCharacteristics::HURT_ROCK);
490             player_ptr->update |= (PU_FLOW);
491         }
492         break;
493
494     case 13:
495         if (name) {
496             return _("乱れ雪月花", "Midare-Setsugekka");
497         }
498         if (desc) {
499             return _("攻撃回数が増え、冷気耐性のないモンスターに大ダメージを与える。",
500                 "Attacks a monster with an increased number of attacks and more damage unless it has resistance to cold.");
501         }
502
503         if (cast) {
504             POSITION y, x;
505
506             if (!get_direction(player_ptr, &dir, false, false)) {
507                 return nullptr;
508             }
509             if (dir == 5) {
510                 return nullptr;
511             }
512
513             y = player_ptr->y + ddy[dir];
514             x = player_ptr->x + ddx[dir];
515
516             if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
517                 do_cmd_attack(player_ptr, y, x, HISSATSU_COLD);
518             } else {
519                 msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
520                 return nullptr;
521             }
522         }
523         break;
524
525     case 14:
526         if (name) {
527             return _("急所突き", "Spot Aiming");
528         }
529         if (desc) {
530             return _("モンスターを一撃で倒す攻撃を繰り出す。失敗すると1点しかダメージを与えられない。",
531                 "Attempts to kill a monster instantly. If that fails, causes only 1HP of damage.");
532         }
533
534         if (cast) {
535             POSITION y, x;
536
537             if (!get_direction(player_ptr, &dir, false, false)) {
538                 return nullptr;
539             }
540             if (dir == 5) {
541                 return nullptr;
542             }
543
544             y = player_ptr->y + ddy[dir];
545             x = player_ptr->x + ddx[dir];
546
547             if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
548                 do_cmd_attack(player_ptr, y, x, HISSATSU_KYUSHO);
549             } else {
550                 msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
551                 return nullptr;
552             }
553         }
554         break;
555
556     case 15:
557         if (name) {
558             return _("魔神斬り", "Majingiri");
559         }
560         if (desc) {
561             return _("会心の一撃で攻撃する。攻撃がかわされやすい。", "Attempts to attack with a critical hit, but this attack is easy to evade for a monster.");
562         }
563
564         if (cast) {
565             POSITION y, x;
566
567             if (!get_direction(player_ptr, &dir, false, false)) {
568                 return nullptr;
569             }
570             if (dir == 5) {
571                 return nullptr;
572             }
573
574             y = player_ptr->y + ddy[dir];
575             x = player_ptr->x + ddx[dir];
576
577             if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
578                 do_cmd_attack(player_ptr, y, x, HISSATSU_MAJIN);
579             } else {
580                 msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
581                 return nullptr;
582             }
583         }
584         break;
585
586     case 16:
587         if (name) {
588             return _("捨て身", "Desperate Attack");
589         }
590         if (desc) {
591             return _("強力な攻撃を繰り出す。次のターンまでの間、食らうダメージが増える。",
592                 "Attacks with all of your power, but all damage you take will be doubled for one turn.");
593         }
594
595         if (cast) {
596             POSITION y, x;
597
598             if (!get_direction(player_ptr, &dir, false, false)) {
599                 return nullptr;
600             }
601             if (dir == 5) {
602                 return nullptr;
603             }
604
605             y = player_ptr->y + ddy[dir];
606             x = player_ptr->x + ddx[dir];
607
608             if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
609                 do_cmd_attack(player_ptr, y, x, HISSATSU_SUTEMI);
610             } else {
611                 msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
612                 return nullptr;
613             }
614             player_ptr->sutemi = true;
615         }
616         break;
617
618     case 17:
619         if (name) {
620             return _("雷撃鷲爪斬", "Lightning Eagle");
621         }
622         if (desc) {
623             return _("電撃耐性のないモンスターに非常に大きいダメージを与える。", "Attacks a monster with more damage unless it has resistance to electricity.");
624         }
625
626         if (cast) {
627             POSITION y, x;
628
629             if (!get_direction(player_ptr, &dir, false, false)) {
630                 return nullptr;
631             }
632             if (dir == 5) {
633                 return nullptr;
634             }
635
636             y = player_ptr->y + ddy[dir];
637             x = player_ptr->x + ddx[dir];
638
639             if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
640                 do_cmd_attack(player_ptr, y, x, HISSATSU_ELEC);
641             } else {
642                 msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
643                 return nullptr;
644             }
645         }
646         break;
647
648     case 18:
649         if (name) {
650             return _("入身", "Rush Attack");
651         }
652         if (desc) {
653             return _("素早く相手に近寄り攻撃する。", "Steps close to a monster and attacks at the same time.");
654         }
655
656         if (cast) {
657             if (!rush_attack(player_ptr, nullptr)) {
658                 return nullptr;
659             }
660         }
661         break;
662
663     case 19:
664         if (name) {
665             return _("赤流渦", "Bloody Maelstrom");
666         }
667
668         if (desc) {
669             return _("自分自身も傷を作りつつ、その傷が深いほど大きい威力で全方向の敵を攻撃できる。生きていないモンスターには効果がない。",
670                 "Attacks all adjacent monsters with power corresponding to your cuts. Then increases your cuts. Has no effect on unliving monsters.");
671         }
672
673         if (cast) {
674             POSITION y = 0, x = 0;
675             auto current_cut = player_ptr->effects()->cut()->current();
676             short new_cut = current_cut < 300 ? current_cut + 300 : current_cut * 2;
677             (void)BadStatusSetter(player_ptr).set_cut(new_cut);
678             for (dir = 0; dir < 8; dir++) {
679                 y = player_ptr->y + ddy_ddd[dir];
680                 x = player_ptr->x + ddx_ddd[dir];
681                 auto *g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
682                 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
683                 if ((g_ptr->m_idx == 0) || (!m_ptr->ml && !cave_has_flag_bold(player_ptr->current_floor_ptr, y, x, TerrainCharacteristics::PROJECT))) {
684                     continue;
685                 }
686
687                 if (monster_living(m_ptr->r_idx)) {
688                     do_cmd_attack(player_ptr, y, x, HISSATSU_SEKIRYUKA);
689                     continue;
690                 }
691
692                 GAME_TEXT m_name[MAX_NLEN];
693                 monster_desc(player_ptr, m_name, m_ptr, 0);
694                 msg_format(_("%sには効果がない!", "%s is unharmed!"), m_name);
695             }
696         }
697
698         break;
699     case 20:
700         if (name) {
701             return _("激震撃", "Earthquake Blow");
702         }
703         if (desc) {
704             return _("地震を起こす。", "Shakes dungeon structure, and results in random swapping of floors and walls.");
705         }
706
707         if (cast) {
708             POSITION y, x;
709
710             if (!get_direction(player_ptr, &dir, false, false)) {
711                 return nullptr;
712             }
713             if (dir == 5) {
714                 return nullptr;
715             }
716
717             y = player_ptr->y + ddy[dir];
718             x = player_ptr->x + ddx[dir];
719
720             if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
721                 do_cmd_attack(player_ptr, y, x, HISSATSU_QUAKE);
722             } else {
723                 earthquake(player_ptr, player_ptr->y, player_ptr->x, 10, 0);
724             }
725         }
726         break;
727
728     case 21:
729         if (name) {
730             return _("地走り", "Crack");
731         }
732         if (desc) {
733             return _("衝撃波のビームを放つ。", "Fires a shock wave as a beam.");
734         }
735
736         if (cast) {
737             int total_damage = 0, basedam, i;
738             ItemEntity *o_ptr;
739             if (!get_aim_dir(player_ptr, &dir)) {
740                 return nullptr;
741             }
742             msg_print(_("武器を大きく振り下ろした。", "You swing your weapon downward."));
743             for (i = 0; i < 2; i++) {
744                 int damage;
745
746                 if (!has_melee_weapon(player_ptr, INVEN_MAIN_HAND + i)) {
747                     break;
748                 }
749                 o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND + i];
750                 basedam = (o_ptr->dd * (o_ptr->ds + 1)) * 50;
751                 damage = o_ptr->to_d * 100;
752                 auto flgs = object_flags(o_ptr);
753
754                 // @todo ヴォーパルの多重定義.
755                 if (o_ptr->is_specific_artifact(FixedArtifactId::VORPAL_BLADE) || o_ptr->is_specific_artifact(FixedArtifactId::CHAINSWORD)) {
756                     /* vorpal blade */
757                     basedam *= 5;
758                     basedam /= 3;
759                 } else if (flgs.has(TR_VORPAL)) {
760                     /* vorpal flag only */
761                     basedam *= 11;
762                     basedam /= 9;
763                 }
764                 damage += basedam;
765                 damage *= player_ptr->num_blow[i];
766                 total_damage += damage / 200;
767                 if (i) {
768                     total_damage = total_damage * 7 / 10;
769                 }
770             }
771             fire_beam(player_ptr, AttributeType::FORCE, dir, total_damage);
772         }
773         break;
774
775     case 22:
776         if (name) {
777             return _("気迫の雄叫び", "War Cry");
778         }
779         if (desc) {
780             return _("視界内の全モンスターに対して轟音の攻撃を行う。さらに、近くにいるモンスターを怒らせる。",
781                 "Damages all monsters in sight with sound. Aggravates nearby monsters.");
782         }
783
784         if (cast) {
785             msg_print(_("雄叫びをあげた!", "You roar!"));
786             project_all_los(player_ptr, AttributeType::SOUND, randint1(plev * 3));
787             aggravate_monsters(player_ptr, 0);
788         }
789         break;
790
791     case 23:
792         if (name) {
793             return _("無双三段", "Musou-Sandan");
794         }
795         if (desc) {
796             return _("強力な3段攻撃を繰り出す。", "Attacks with three powerful strikes.");
797         }
798
799         if (cast) {
800             int i;
801
802             if (!get_direction(player_ptr, &dir, false, false)) {
803                 return nullptr;
804             }
805             if (dir == 5) {
806                 return nullptr;
807             }
808
809             for (i = 0; i < 3; i++) {
810                 POSITION y, x;
811                 POSITION ny, nx;
812                 MONSTER_IDX m_idx;
813                 grid_type *g_ptr;
814                 MonsterEntity *m_ptr;
815
816                 y = player_ptr->y + ddy[dir];
817                 x = player_ptr->x + ddx[dir];
818                 g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
819
820                 if (g_ptr->m_idx) {
821                     do_cmd_attack(player_ptr, y, x, HISSATSU_3DAN);
822                 } else {
823                     msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
824                     return nullptr;
825                 }
826
827                 if (dungeons_info[player_ptr->dungeon_idx].flags.has(DungeonFeatureType::NO_MELEE)) {
828                     return "";
829                 }
830
831                 /* Monster is dead? */
832                 if (!g_ptr->m_idx) {
833                     break;
834                 }
835
836                 ny = y + ddy[dir];
837                 nx = x + ddx[dir];
838                 m_idx = g_ptr->m_idx;
839                 m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
840
841                 /* Monster cannot move back? */
842                 if (!monster_can_enter(player_ptr, ny, nx, &monraces_info[m_ptr->r_idx], 0)) {
843                     /* -more- */
844                     if (i < 2) {
845                         msg_print(nullptr);
846                     }
847                     continue;
848                 }
849
850                 g_ptr->m_idx = 0;
851                 player_ptr->current_floor_ptr->grid_array[ny][nx].m_idx = m_idx;
852                 m_ptr->fy = ny;
853                 m_ptr->fx = nx;
854
855                 update_monster(player_ptr, m_idx, true);
856
857                 /* Redraw the old spot */
858                 lite_spot(player_ptr, y, x);
859
860                 /* Redraw the new spot */
861                 lite_spot(player_ptr, ny, nx);
862
863                 /* Player can move forward? */
864                 if (player_can_enter(player_ptr, g_ptr->feat, 0)) {
865                     if (!move_player_effect(player_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP)) {
866                         break;
867                     }
868                 } else {
869                     break;
870                 }
871
872                 /* -more- */
873                 if (i < 2) {
874                     msg_print(nullptr);
875                 }
876             }
877         }
878         break;
879
880     case 24:
881         if (name) {
882             return _("吸血鬼の牙", "Vampire's Fang");
883         }
884         if (desc) {
885             return _("攻撃した相手の体力を吸いとり、自分の体力を回復させる。生命を持たないモンスターには通じない。",
886                 "Attacks with vampiric strikes which absorb HP from a monster and heal you. Has no effect on unliving monsters.");
887         }
888
889         if (cast) {
890             POSITION y, x;
891
892             if (!get_direction(player_ptr, &dir, false, false)) {
893                 return nullptr;
894             }
895             if (dir == 5) {
896                 return nullptr;
897             }
898
899             y = player_ptr->y + ddy[dir];
900             x = player_ptr->x + ddx[dir];
901
902             if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
903                 do_cmd_attack(player_ptr, y, x, HISSATSU_DRAIN);
904             } else {
905                 msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
906                 return nullptr;
907             }
908         }
909         break;
910
911     case 25:
912         if (name) {
913             return _("幻惑", "Moon Dazzling");
914         }
915         if (desc) {
916             return _("視界内の起きている全モンスターに朦朧、混乱、眠りを与えようとする。", "Attempts to stun, confuse and put to sleep all waking monsters.");
917         }
918
919         if (cast) {
920             msg_print(_("武器を不規則に揺らした...", "You irregularly wave your weapon..."));
921             project_all_los(player_ptr, AttributeType::ENGETSU, plev * 4);
922         }
923         break;
924
925     case 26:
926         if (name) {
927             return _("百人斬り", "Hundred Slaughter");
928         }
929         if (desc) {
930             return _("連続して入身でモンスターを攻撃する。攻撃するたびにMPを消費。MPがなくなるか、モンスターを倒せなかったら百人斬りは終了する。",
931                 "Performs a series of rush attacks. The series continues as long as the attacked monster dies and you have sufficient SP.");
932         }
933
934         if (cast) {
935             const int mana_cost_per_monster = 8;
936             bool is_new = true;
937             bool mdeath;
938
939             do {
940                 if (!rush_attack(player_ptr, &mdeath)) {
941                     break;
942                 }
943                 if (is_new) {
944                     /* Reserve needed mana point */
945                     player_ptr->csp -= technic_info[REALM_HISSATSU - MIN_TECHNIC][26].smana;
946                     is_new = false;
947                 } else {
948                     player_ptr->csp -= mana_cost_per_monster;
949                 }
950
951                 if (!mdeath) {
952                     break;
953                 }
954                 command_dir = 0;
955
956                 player_ptr->redraw |= PR_MANA;
957                 handle_stuff(player_ptr);
958             } while (player_ptr->csp > mana_cost_per_monster);
959
960             if (is_new) {
961                 return nullptr;
962             }
963
964             /* Restore reserved mana */
965             player_ptr->csp += technic_info[REALM_HISSATSU - MIN_TECHNIC][26].smana;
966         }
967         break;
968
969     case 27:
970         if (name) {
971             return _("天翔龍閃", "Dragonic Flash");
972         }
973         if (desc) {
974             return _("視界内の場所を指定して、その場所と自分の間にいる全モンスターを攻撃し、その場所に移動する。",
975                 "Runs toward given location while attacking all monsters on the path.");
976         }
977
978         if (cast) {
979             POSITION y, x;
980
981             if (!tgt_pt(player_ptr, &x, &y)) {
982                 return nullptr;
983             }
984
985             if (!cave_player_teleportable_bold(player_ptr, y, x, TELEPORT_SPONTANEOUS) || (distance(y, x, player_ptr->y, player_ptr->x) > MAX_PLAYER_SIGHT / 2) || !projectable(player_ptr, player_ptr->y, player_ptr->x, y, x)) {
986                 msg_print(_("失敗!", "You cannot move to that place!"));
987                 break;
988             }
989             if (player_ptr->anti_tele) {
990                 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
991                 break;
992             }
993             project(player_ptr, 0, 0, y, x, HISSATSU_ISSEN, AttributeType::ATTACK, PROJECT_BEAM | PROJECT_KILL);
994             teleport_player_to(player_ptr, y, x, TELEPORT_SPONTANEOUS);
995         }
996         break;
997
998     case 28:
999         if (name) {
1000             return _("二重の剣撃", "Twin Slash");
1001         }
1002         if (desc) {
1003             return _("1ターンで2度攻撃を行う。", "Attack twice in one turn.");
1004         }
1005
1006         if (cast) {
1007             POSITION x, y;
1008
1009             if (!get_rep_dir(player_ptr, &dir, false)) {
1010                 return nullptr;
1011             }
1012
1013             y = player_ptr->y + ddy[dir];
1014             x = player_ptr->x + ddx[dir];
1015
1016             if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
1017                 do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
1018                 if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
1019                     handle_stuff(player_ptr);
1020                     do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
1021                 }
1022             } else {
1023                 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
1024                 return nullptr;
1025             }
1026         }
1027         break;
1028
1029     case 29:
1030         if (name) {
1031             return _("虎伏絶刀勢", "Kofuku-Zettousei");
1032         }
1033         if (desc) {
1034             return _("強力な攻撃を行い、近くの場所にも効果が及ぶ。", "Performs a powerful attack which even affects nearby monsters.");
1035         }
1036
1037         if (cast) {
1038             int total_damage = 0, basedam, i;
1039             POSITION y, x;
1040             ItemEntity *o_ptr;
1041
1042             if (!get_direction(player_ptr, &dir, false, false)) {
1043                 return nullptr;
1044             }
1045             if (dir == 5) {
1046                 return nullptr;
1047             }
1048
1049             y = player_ptr->y + ddy[dir];
1050             x = player_ptr->x + ddx[dir];
1051
1052             if (dungeons_info[player_ptr->dungeon_idx].flags.has(DungeonFeatureType::NO_MELEE)) {
1053                 msg_print(_("なぜか攻撃することができない。", "Something prevents you from attacking."));
1054                 return "";
1055             }
1056             msg_print(_("武器を大きく振り下ろした。", "You swing your weapon downward."));
1057             for (i = 0; i < 2; i++) {
1058                 int damage;
1059                 if (!has_melee_weapon(player_ptr, INVEN_MAIN_HAND + i)) {
1060                     break;
1061                 }
1062                 o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND + i];
1063                 basedam = (o_ptr->dd * (o_ptr->ds + 1)) * 50;
1064                 damage = o_ptr->to_d * 100;
1065                 auto flgs = object_flags(o_ptr);
1066
1067                 // @todo ヴォーパルの多重定義.
1068                 if (o_ptr->is_specific_artifact(FixedArtifactId::VORPAL_BLADE) || o_ptr->is_specific_artifact(FixedArtifactId::CHAINSWORD)) {
1069                     /* vorpal blade */
1070                     basedam *= 5;
1071                     basedam /= 3;
1072                 } else if (flgs.has(TR_VORPAL)) {
1073                     /* vorpal flag only */
1074                     basedam *= 11;
1075                     basedam /= 9;
1076                 }
1077                 damage += basedam;
1078                 damage += player_ptr->to_d[i] * 100;
1079                 damage *= player_ptr->num_blow[i];
1080                 total_damage += (damage / 100);
1081             }
1082             project(player_ptr, 0, (cave_has_flag_bold(player_ptr->current_floor_ptr, y, x, TerrainCharacteristics::PROJECT) ? 5 : 0), y, x, total_damage * 3 / 2, AttributeType::METEOR,
1083                 PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM);
1084         }
1085         break;
1086
1087     case 30:
1088         if (name) {
1089             return _("慶雲鬼忍剣", "Keiun-Kininken");
1090         }
1091         if (desc) {
1092             return _("自分もダメージをくらうが、相手に非常に大きなダメージを与える。アンデッドには特に効果がある。",
1093                 "Attacks a monster with extremely powerful damage, but you also take some damage. Hurts an undead monster greatly.");
1094         }
1095
1096         if (cast) {
1097             POSITION y, x;
1098
1099             if (!get_direction(player_ptr, &dir, false, false)) {
1100                 return nullptr;
1101             }
1102             if (dir == 5) {
1103                 return nullptr;
1104             }
1105
1106             y = player_ptr->y + ddy[dir];
1107             x = player_ptr->x + ddx[dir];
1108
1109             if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
1110                 do_cmd_attack(player_ptr, y, x, HISSATSU_UNDEAD);
1111             } else {
1112                 msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
1113                 return nullptr;
1114             }
1115             take_hit(player_ptr, DAMAGE_NOESCAPE, 100 + randint1(100), _("慶雲鬼忍剣を使った衝撃", "exhaustion on using Keiun-Kininken"));
1116         }
1117         break;
1118
1119     case 31:
1120         if (name) {
1121             return _("切腹", "Harakiri");
1122         }
1123         if (desc) {
1124             return _("「武士道とは、死ぬことと見つけたり。」", "'Bushido, the way of warriors, is found in death'");
1125         }
1126
1127         if (cast) {
1128             int i;
1129             if (!get_check(_("本当に自殺しますか?", "Do you really want to commit suicide? "))) {
1130                 return nullptr;
1131             }
1132             /* Special Verification for suicide */
1133             prt(_("確認のため '@' を押して下さい。", "Please verify SUICIDE by typing the '@' sign: "), 0, 0);
1134
1135             flush();
1136             i = inkey();
1137             prt("", 0, 0);
1138             if (i != '@') {
1139                 return nullptr;
1140             }
1141             if (w_ptr->total_winner) {
1142                 take_hit(player_ptr, DAMAGE_FORCE, 9999, "Seppuku");
1143                 w_ptr->total_winner = true;
1144             } else {
1145                 msg_print(_("武士道とは、死ぬことと見つけたり。", "The meaning of bushido is found in death."));
1146                 take_hit(player_ptr, DAMAGE_FORCE, 9999, "Seppuku");
1147             }
1148         }
1149         break;
1150     }
1151
1152     return "";
1153 }