2 * @brief レイシャルと突然変異の技能処理 / Racial powers (and mutations)
5 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
6 * This software may be copied and distributed for educational, research,\n
7 * and not for profit purposes provided that this copyright and statement\n
8 * are included in all such copies. Other copyrights may also apply.\n
9 * 2014 Deskull rearranged comment for Doxygen. \n
12 #include "racial/racial-switcher.h"
13 #include "action/action-limited.h"
14 #include "action/mutation-execution.h"
15 #include "cmd-action/cmd-mane.h"
16 #include "cmd-action/cmd-spell.h"
17 #include "cmd-item/cmd-magiceat.h"
18 #include "cmd-item/cmd-zapwand.h"
19 #include "core/player-redraw-types.h"
20 #include "core/player-update-types.h"
21 #include "core/stuff-handler.h"
22 #include "core/window-redrawer.h"
23 #include "effect/spells-effect-util.h"
24 #include "game-option/text-display-options.h"
25 #include "inventory/inventory-slot-types.h"
26 #include "io/command-repeater.h"
27 #include "io/input-key-acceptor.h"
28 #include "io/input-key-requester.h"
29 #include "main/sound-of-music.h"
30 #include "melee/melee-postprocess.h"
31 #include "mind/mind-archer.h"
32 #include "mind/mind-cavalry.h"
33 #include "mind/mind-elementalist.h"
34 #include "mind/mind-force-trainer.h"
35 #include "mind/mind-hobbit.h"
36 #include "mind/mind-mage.h"
37 #include "mind/mind-magic-eater.h"
38 #include "mind/mind-mirror-master.h"
39 #include "mind/mind-monk.h"
40 #include "mind/mind-ninja.h"
41 #include "mind/mind-priest.h"
42 #include "mind/mind-samurai.h"
43 #include "mind/mind-warrior-mage.h"
44 #include "mind/mind-warrior.h"
45 #include "mind/monk-attack.h"
46 #include "mind/stances-table.h"
47 #include "mutation/mutation-flag-types.h"
48 #include "object/item-tester-hooker.h"
49 #include "player-info/class-info.h"
50 #include "player-info/equipment-info.h"
51 #include "player-info/race-info.h"
52 #include "player-info/race-types.h"
53 #include "player-status/player-energy.h"
54 #include "player-status/player-hand-types.h"
55 #include "player/attack-defense-types.h"
56 #include "player/player-damage.h"
57 #include "player/player-status.h"
58 #include "racial/racial-android.h"
59 #include "racial/racial-balrog.h"
60 #include "racial/racial-draconian.h"
61 #include "racial/racial-kutar.h"
62 #include "racial/racial-vampire.h"
63 #include "realm/realm-names-table.h"
64 #include "spell-kind/spells-beam.h"
65 #include "spell-kind/spells-detection.h"
66 #include "spell-kind/spells-grid.h"
67 #include "spell-kind/spells-launcher.h"
68 #include "spell-kind/spells-neighbor.h"
69 #include "spell-kind/spells-perception.h"
70 #include "spell-kind/spells-sight.h"
71 #include "spell-kind/spells-teleport.h"
72 #include "spell-kind/spells-world.h"
73 #include "spell-realm/spells-hex.h"
74 #include "spell-realm/spells-song.h"
75 #include "spell/spell-types.h"
76 #include "spell/spells-status.h"
77 #include "status/action-setter.h"
78 #include "status/bad-status-setter.h"
79 #include "status/buff-setter.h"
80 #include "status/experience.h"
81 #include "system/player-type-definition.h"
82 #include "target/target-getter.h"
83 #include "util/bit-flags-calculator.h"
84 #include "util/int-char-converter.h"
85 #include "view/display-messages.h"
87 bool switch_class_racial_execution(player_type *player_ptr, const int32_t command)
90 switch (player_ptr->pclass) {
92 return sword_dancing(player_ptr);
94 if (player_ptr->realm1 == REALM_HEX) {
95 auto retval = SpellHex(player_ptr).stop_spells_with_selection();
97 PlayerEnergy(player_ptr).set_player_turn_energy(10);
106 return eat_magic(player_ptr, player_ptr->lev * 2);
108 if (!is_good_realm(player_ptr->realm1)) {
109 (void)dispel_monsters(player_ptr, player_ptr->lev * 4);
110 turn_monsters(player_ptr, player_ptr->lev * 4);
111 banish_monsters(player_ptr, player_ptr->lev * 4);
115 return bless_weapon(player_ptr);
117 return hit_and_away(player_ptr);
120 msg_print(_("敵を調査した...", "You examine your foes..."));
124 if (!get_aim_dir(player_ptr, &dir))
127 fire_beam(player_ptr, is_good_realm(player_ptr->realm1) ? GF_HOLY_FIRE : GF_HELL_FIRE, dir, player_ptr->lev * 3);
129 case CLASS_WARRIOR_MAGE:
131 return comvert_hp_to_mp(player_ptr);
132 else if (command == -4)
133 return comvert_mp_to_hp(player_ptr);
136 case CLASS_CHAOS_WARRIOR:
137 return confusing_light(player_ptr);
139 if (none_bits(empty_hands(player_ptr, true), EMPTY_HAND_MAIN)) {
140 msg_print(_("素手じゃないとできません。", "You need to be barehanded."));
144 if (player_ptr->riding) {
145 msg_print(_("乗馬中はできません。", "You need to get off a pet."));
150 if (!choose_monk_stance(player_ptr))
153 set_bits(player_ptr->update, PU_BONUS);
158 return double_attack(player_ptr);
161 case CLASS_MINDCRAFTER:
162 case CLASS_FORCETRAINER:
163 return clear_mind(player_ptr);
166 if (!get_aim_dir(player_ptr, &dir))
170 fire_beam(player_ptr, GF_PHOTO, dir, 1);
174 return (command != -4) || identify_fully(player_ptr, false);
176 handle_stuff(player_ptr);
177 return do_cmd_mane(player_ptr, true);
178 case CLASS_BEASTMASTER:
180 if (!get_aim_dir(player_ptr, &dir))
183 (void)fire_ball_hide(player_ptr, GF_CHARM_LIVING, dir, player_ptr->lev, 0);
188 project_all_los(player_ptr, GF_CHARM_LIVING, player_ptr->lev);
192 return create_ammo(player_ptr);
193 case CLASS_MAGIC_EATER:
195 return import_magic_device(player_ptr);
197 return (command != -4) || (!cmd_limit_cast(player_ptr) && do_cmd_magic_eater(player_ptr, false, true));
199 if ((get_singing_song_effect(player_ptr) == 0) && (get_interrupting_song_effect(player_ptr) == 0))
202 stop_singing(player_ptr);
203 PlayerEnergy(player_ptr).set_player_turn_energy(10);
206 if (cmd_limit_cast(player_ptr))
209 handle_stuff(player_ptr);
210 if (!do_cmd_cast(player_ptr))
213 if (!player_ptr->paralyzed && !cmd_limit_cast(player_ptr)) {
214 handle_stuff(player_ptr);
216 (void)do_cmd_cast(player_ptr);
221 concentration(player_ptr);
228 if (!has_melee_weapon(player_ptr, INVEN_MAIN_HAND) && !has_melee_weapon(player_ptr, INVEN_SUB_HAND)) {
229 msg_print(_("武器を持たないといけません。", "You need to wield a weapon."));
233 if (!choose_kata(player_ptr))
236 set_bits(player_ptr->update, PU_BONUS);
238 case CLASS_BLUE_MAGE:
239 set_action(player_ptr, player_ptr->action == ACTION_LEARN ? ACTION_NONE : ACTION_LEARN);
240 PlayerEnergy(player_ptr).reset_player_turn();
243 return rodeo(player_ptr);
244 case CLASS_BERSERKER:
245 return recall_player(player_ptr, randint0(21) + 15);
247 if (player_ptr->lev <= 29)
248 return ident_spell(player_ptr, true);
250 return identify_fully(player_ptr, true);
251 case CLASS_MIRROR_MASTER:
253 remove_all_mirrors(player_ptr, true);
258 return mirror_concentration(player_ptr);
262 return hayagake(player_ptr);
263 case CLASS_ELEMENTALIST:
265 return clear_mind(player_ptr);
267 return switch_element_execution(player_ptr);
274 bool switch_mimic_racial_execution(player_type *player_ptr)
276 switch (player_ptr->mimic_form) {
278 case MIMIC_DEMON_LORD: {
279 return demonic_breath(player_ptr);
282 vampirism(player_ptr);
289 bool switch_race_racial_execution(player_type *player_ptr, const int32_t command)
292 switch (player_ptr->prace) {
293 case player_race_type::DWARF:
294 msg_print(_("周囲を調べた。", "You examine your surroundings."));
295 (void)detect_traps(player_ptr, DETECT_RAD_DEFAULT, true);
296 (void)detect_doors(player_ptr, DETECT_RAD_DEFAULT);
297 (void)detect_stairs(player_ptr, DETECT_RAD_DEFAULT);
299 case player_race_type::HOBBIT:
300 return create_ration(player_ptr);
301 case player_race_type::GNOME:
302 msg_print(_("パッ!", "Blink!"));
303 teleport_player(player_ptr, 10, TELEPORT_SPONTANEOUS);
305 case player_race_type::HALF_ORC:
306 msg_print(_("勇気を出した。", "You play tough."));
307 (void)set_afraid(player_ptr, 0);
309 case player_race_type::HALF_TROLL:
310 msg_print(_("うがぁぁ!", "RAAAGH!"));
311 (void)berserk(player_ptr, 10 + randint1(player_ptr->lev));
313 case player_race_type::AMBERITE:
315 msg_print(_("あなたは歩き周り始めた。", "You start walking around. "));
316 reserve_alter_reality(player_ptr, randint0(21) + 15);
323 msg_print(_("あなたは「パターン」を心に描いてその上を歩いた...", "You picture the Pattern in your mind and walk it..."));
324 (void)true_healing(player_ptr, 0);
325 (void)restore_all_status(player_ptr);
326 (void)restore_level(player_ptr);
328 case player_race_type::BARBARIAN:
329 msg_print(_("うぉぉおお!", "Raaagh!"));
330 (void)berserk(player_ptr, 10 + randint1(player_ptr->lev));
332 case player_race_type::HALF_OGRE:
333 msg_print(_("爆発のルーンを慎重に仕掛けた...", "You carefully set an explosive rune..."));
334 (void)create_rune_explosion(player_ptr, player_ptr->y, player_ptr->x);
336 case player_race_type::HALF_GIANT:
337 if (!get_aim_dir(player_ptr, &dir))
340 (void)wall_to_mud(player_ptr, dir, 20 + randint1(30));
342 case player_race_type::HALF_TITAN:
343 msg_print(_("敵を調査した...", "You examine your foes..."));
344 (void)probing(player_ptr);
346 case player_race_type::CYCLOPS:
347 if (!get_aim_dir(player_ptr, &dir))
350 msg_print(_("巨大な岩を投げた。", "You throw a huge boulder."));
351 (void)fire_bolt(player_ptr, GF_MISSILE, dir, (3 * player_ptr->lev) / 2);
353 case player_race_type::YEEK:
354 if (!get_aim_dir(player_ptr, &dir))
357 stop_mouth(player_ptr);
358 msg_print(_("身の毛もよだつ叫び声を上げた!", "You make a horrible scream!"));
359 (void)fear_monster(player_ptr, dir, player_ptr->lev);
361 case player_race_type::KLACKON:
362 if (!get_aim_dir(player_ptr, &dir))
365 stop_mouth(player_ptr);
366 msg_print(_("酸を吐いた。", "You spit acid."));
367 if (player_ptr->lev < 25)
368 (void)fire_bolt(player_ptr, GF_ACID, dir, player_ptr->lev);
370 (void)fire_ball(player_ptr, GF_ACID, dir, player_ptr->lev, 2);
373 case player_race_type::KOBOLD:
374 if (!get_aim_dir(player_ptr, &dir))
377 msg_print(_("毒のダーツを投げた。", "You throw a poisoned dart."));
378 (void)fire_bolt(player_ptr, GF_POIS, dir, player_ptr->lev);
380 case player_race_type::NIBELUNG:
381 msg_print(_("周囲を調査した。", "You examine your surroundings."));
382 (void)detect_traps(player_ptr, DETECT_RAD_DEFAULT, true);
383 (void)detect_doors(player_ptr, DETECT_RAD_DEFAULT);
384 (void)detect_stairs(player_ptr, DETECT_RAD_DEFAULT);
386 case player_race_type::DARK_ELF:
387 if (!get_aim_dir(player_ptr, &dir))
390 msg_print(_("マジック・ミサイルを放った。", "You cast a magic missile."));
391 (void)fire_bolt_or_beam(player_ptr, 10, GF_MISSILE, dir, damroll(3 + ((player_ptr->lev - 1) / 5), 4));
393 case player_race_type::DRACONIAN:
394 return draconian_breath(player_ptr);
395 case player_race_type::MIND_FLAYER:
396 if (!get_aim_dir(player_ptr, &dir))
399 msg_print(_("あなたは集中し、目が赤く輝いた...", "You concentrate and your eyes glow red..."));
400 (void)fire_bolt(player_ptr, GF_PSI, dir, player_ptr->lev);
402 case player_race_type::IMP:
403 if (!get_aim_dir(player_ptr, &dir))
406 if (player_ptr->lev >= 30) {
407 msg_print(_("ファイア・ボールを放った。", "You cast a ball of fire."));
408 (void)fire_ball(player_ptr, GF_FIRE, dir, player_ptr->lev, 2);
410 msg_print(_("ファイア・ボルトを放った。", "You cast a bolt of fire."));
411 (void)fire_bolt(player_ptr, GF_FIRE, dir, player_ptr->lev);
415 case player_race_type::GOLEM:
416 (void)set_shield(player_ptr, randint1(20) + 30, false);
418 case player_race_type::SKELETON:
419 case player_race_type::ZOMBIE:
420 msg_print(_("あなたは失ったエネルギーを取り戻そうと試みた。", "You attempt to restore your lost energies."));
421 (void)restore_level(player_ptr);
423 case player_race_type::VAMPIRE:
424 (void)vampirism(player_ptr);
426 case player_race_type::SPECTRE:
427 if (!get_aim_dir(player_ptr, &dir))
430 stop_mouth(player_ptr);
431 msg_print(_("あなたはおどろおどろしい叫び声をあげた!", "You emit an eldritch howl!"));
432 (void)fear_monster(player_ptr, dir, player_ptr->lev);
434 case player_race_type::SPRITE:
435 msg_print(_("あなたは魔法の粉を投げつけた...", "You throw some magic dust..."));
436 if (player_ptr->lev < 25)
437 (void)sleep_monsters_touch(player_ptr);
439 (void)sleep_monsters(player_ptr, player_ptr->lev);
442 case player_race_type::BALROG:
443 return demonic_breath(player_ptr);
444 case player_race_type::KUTAR:
445 (void)set_leveling(player_ptr, randint1(20) + 30, false);
447 case player_race_type::ANDROID:
448 return android_inside_weapon(player_ptr);
450 msg_print(_("この種族は特殊な能力を持っていません。", "This race has no bonus power."));
451 PlayerEnergy(player_ptr).reset_player_turn();