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/spells-status.h"
76 #include "status/action-setter.h"
77 #include "status/bad-status-setter.h"
78 #include "status/buff-setter.h"
79 #include "status/experience.h"
80 #include "system/player-type-definition.h"
81 #include "target/target-getter.h"
82 #include "timed-effect/player-paralysis.h"
83 #include "timed-effect/timed-effects.h"
84 #include "util/bit-flags-calculator.h"
85 #include "util/int-char-converter.h"
86 #include "view/display-messages.h"
88 bool switch_class_racial_execution(PlayerType *player_ptr, const int32_t command)
91 switch (player_ptr->pclass) {
92 case PlayerClassType::WARRIOR:
93 return sword_dancing(player_ptr);
94 case PlayerClassType::HIGH_MAGE:
95 if (player_ptr->realm1 == REALM_HEX) {
96 auto retval = SpellHex(player_ptr).stop_spells_with_selection();
98 PlayerEnergy(player_ptr).set_player_turn_energy(10);
105 case PlayerClassType::MAGE:
106 case PlayerClassType::SORCERER:
107 return eat_magic(player_ptr, player_ptr->lev * 2);
108 case PlayerClassType::PRIEST:
109 if (!is_good_realm(player_ptr->realm1)) {
110 (void)dispel_monsters(player_ptr, player_ptr->lev * 4);
111 turn_monsters(player_ptr, player_ptr->lev * 4);
112 banish_monsters(player_ptr, player_ptr->lev * 4);
116 return bless_weapon(player_ptr);
117 case PlayerClassType::ROGUE:
118 return hit_and_away(player_ptr);
119 case PlayerClassType::RANGER:
120 case PlayerClassType::SNIPER:
121 msg_print(_("敵を調査した...", "You examine your foes..."));
124 case PlayerClassType::PALADIN:
125 if (!get_aim_dir(player_ptr, &dir)) {
129 fire_beam(player_ptr, is_good_realm(player_ptr->realm1) ? AttributeType::HOLY_FIRE : AttributeType::HELL_FIRE, dir, player_ptr->lev * 3);
131 case PlayerClassType::WARRIOR_MAGE:
133 return comvert_hp_to_mp(player_ptr);
134 } else if (command == -4) {
135 return comvert_mp_to_hp(player_ptr);
139 case PlayerClassType::CHAOS_WARRIOR:
140 return confusing_light(player_ptr);
141 case PlayerClassType::MONK:
142 if (none_bits(empty_hands(player_ptr, true), EMPTY_HAND_MAIN)) {
143 msg_print(_("素手じゃないとできません。", "You need to be barehanded."));
147 if (player_ptr->riding) {
148 msg_print(_("乗馬中はできません。", "You need to get off a pet."));
153 if (!choose_monk_stance(player_ptr)) {
157 set_bits(player_ptr->update, PU_BONUS);
162 return double_attack(player_ptr);
166 case PlayerClassType::MINDCRAFTER:
167 case PlayerClassType::FORCETRAINER:
168 return clear_mind(player_ptr);
169 case PlayerClassType::TOURIST:
171 if (!get_aim_dir(player_ptr, &dir)) {
176 fire_beam(player_ptr, AttributeType::PHOTO, dir, 1);
180 return (command != -4) || identify_fully(player_ptr, false);
181 case PlayerClassType::IMITATOR:
182 handle_stuff(player_ptr);
183 return do_cmd_mane(player_ptr, true);
184 case PlayerClassType::BEASTMASTER:
186 if (!get_aim_dir(player_ptr, &dir)) {
190 (void)fire_ball_hide(player_ptr, AttributeType::CHARM_LIVING, dir, player_ptr->lev, 0);
195 project_all_los(player_ptr, AttributeType::CHARM_LIVING, player_ptr->lev);
199 case PlayerClassType::ARCHER:
200 return create_ammo(player_ptr);
201 case PlayerClassType::MAGIC_EATER:
203 return import_magic_device(player_ptr);
206 return (command != -4) || (!cmd_limit_cast(player_ptr) && do_cmd_magic_eater(player_ptr, false, true));
207 case PlayerClassType::BARD:
208 if ((get_singing_song_effect(player_ptr) == 0) && (get_interrupting_song_effect(player_ptr) == 0)) {
212 stop_singing(player_ptr);
213 PlayerEnergy(player_ptr).set_player_turn_energy(10);
215 case PlayerClassType::RED_MAGE:
216 if (cmd_limit_cast(player_ptr)) {
220 handle_stuff(player_ptr);
221 if (!do_cmd_cast(player_ptr)) {
225 if (!player_ptr->effects()->paralysis()->is_paralyzed() && !cmd_limit_cast(player_ptr)) {
226 handle_stuff(player_ptr);
228 (void)do_cmd_cast(player_ptr);
231 case PlayerClassType::SAMURAI:
233 concentration(player_ptr);
241 if (!has_melee_weapon(player_ptr, INVEN_MAIN_HAND) && !has_melee_weapon(player_ptr, INVEN_SUB_HAND)) {
242 msg_print(_("武器を持たないといけません。", "You need to wield a weapon."));
246 if (!choose_samurai_stance(player_ptr)) {
250 set_bits(player_ptr->update, PU_BONUS);
252 case PlayerClassType::BLUE_MAGE:
253 set_action(player_ptr, player_ptr->action == ACTION_LEARN ? ACTION_NONE : ACTION_LEARN);
254 PlayerEnergy(player_ptr).reset_player_turn();
256 case PlayerClassType::CAVALRY:
257 return rodeo(player_ptr);
258 case PlayerClassType::BERSERKER:
259 return recall_player(player_ptr, randint0(21) + 15);
260 case PlayerClassType::SMITH:
261 if (player_ptr->lev <= 29) {
262 return ident_spell(player_ptr, true);
265 return identify_fully(player_ptr, true);
266 case PlayerClassType::MIRROR_MASTER:
268 remove_all_mirrors(player_ptr, true);
273 return mirror_concentration(player_ptr);
277 case PlayerClassType::NINJA:
278 return hayagake(player_ptr);
279 case PlayerClassType::ELEMENTALIST:
281 return clear_mind(player_ptr);
284 return switch_element_execution(player_ptr);
292 bool switch_mimic_racial_execution(PlayerType *player_ptr)
294 switch (player_ptr->mimic_form) {
295 case MimicKindType::DEMON:
296 case MimicKindType::DEMON_LORD: {
297 return demonic_breath(player_ptr);
299 case MimicKindType::VAMPIRE:
300 vampirism(player_ptr);
307 bool switch_race_racial_execution(PlayerType *player_ptr, const int32_t command)
310 switch (player_ptr->prace) {
311 case PlayerRaceType::DWARF:
312 msg_print(_("周囲を調べた。", "You examine your surroundings."));
313 (void)detect_traps(player_ptr, DETECT_RAD_DEFAULT, true);
314 (void)detect_doors(player_ptr, DETECT_RAD_DEFAULT);
315 (void)detect_stairs(player_ptr, DETECT_RAD_DEFAULT);
317 case PlayerRaceType::HOBBIT:
318 return create_ration(player_ptr);
319 case PlayerRaceType::GNOME:
320 msg_print(_("パッ!", "Blink!"));
321 teleport_player(player_ptr, 10, TELEPORT_SPONTANEOUS);
323 case PlayerRaceType::HALF_ORC:
324 msg_print(_("勇気を出した。", "You play tough."));
325 (void)BadStatusSetter(player_ptr).fear(0);
327 case PlayerRaceType::HALF_TROLL:
328 msg_print(_("うがぁぁ!", "RAAAGH!"));
329 (void)berserk(player_ptr, 10 + randint1(player_ptr->lev));
331 case PlayerRaceType::AMBERITE:
333 msg_print(_("あなたは歩き周り始めた。", "You start walking around. "));
334 reserve_alter_reality(player_ptr, randint0(21) + 15);
342 msg_print(_("あなたは「パターン」を心に描いてその上を歩いた...", "You picture the Pattern in your mind and walk it..."));
343 (void)true_healing(player_ptr, 0);
344 (void)restore_all_status(player_ptr);
345 (void)restore_level(player_ptr);
347 case PlayerRaceType::BARBARIAN:
348 msg_print(_("うぉぉおお!", "Raaagh!"));
349 (void)berserk(player_ptr, 10 + randint1(player_ptr->lev));
351 case PlayerRaceType::HALF_OGRE:
352 msg_print(_("爆発のルーンを慎重に仕掛けた...", "You carefully set an explosive rune..."));
353 (void)create_rune_explosion(player_ptr, player_ptr->y, player_ptr->x);
355 case PlayerRaceType::HALF_GIANT:
356 if (!get_aim_dir(player_ptr, &dir)) {
360 (void)wall_to_mud(player_ptr, dir, 20 + randint1(30));
362 case PlayerRaceType::HALF_TITAN:
363 msg_print(_("敵を調査した...", "You examine your foes..."));
364 (void)probing(player_ptr);
366 case PlayerRaceType::CYCLOPS:
367 if (!get_aim_dir(player_ptr, &dir)) {
371 msg_print(_("巨大な岩を投げた。", "You throw a huge boulder."));
372 (void)fire_bolt(player_ptr, AttributeType::MISSILE, dir, (3 * player_ptr->lev) / 2);
374 case PlayerRaceType::YEEK:
375 if (!get_aim_dir(player_ptr, &dir)) {
379 stop_mouth(player_ptr);
380 msg_print(_("身の毛もよだつ叫び声を上げた!", "You make a horrible scream!"));
381 (void)fear_monster(player_ptr, dir, player_ptr->lev);
383 case PlayerRaceType::KLACKON:
384 if (!get_aim_dir(player_ptr, &dir)) {
388 stop_mouth(player_ptr);
389 msg_print(_("酸を吐いた。", "You spit acid."));
390 if (player_ptr->lev < 25) {
391 (void)fire_bolt(player_ptr, AttributeType::ACID, dir, player_ptr->lev);
393 (void)fire_ball(player_ptr, AttributeType::ACID, dir, player_ptr->lev, 2);
397 case PlayerRaceType::KOBOLD:
398 if (!get_aim_dir(player_ptr, &dir)) {
402 msg_print(_("毒のダーツを投げた。", "You throw a poisoned dart."));
403 (void)fire_bolt(player_ptr, AttributeType::POIS, dir, player_ptr->lev);
405 case PlayerRaceType::NIBELUNG:
406 msg_print(_("周囲を調査した。", "You examine your surroundings."));
407 (void)detect_traps(player_ptr, DETECT_RAD_DEFAULT, true);
408 (void)detect_doors(player_ptr, DETECT_RAD_DEFAULT);
409 (void)detect_stairs(player_ptr, DETECT_RAD_DEFAULT);
411 case PlayerRaceType::DARK_ELF:
412 if (!get_aim_dir(player_ptr, &dir)) {
416 msg_print(_("マジック・ミサイルを放った。", "You cast a magic missile."));
417 (void)fire_bolt_or_beam(player_ptr, 10, AttributeType::MISSILE, dir, damroll(3 + ((player_ptr->lev - 1) / 5), 4));
419 case PlayerRaceType::DRACONIAN:
420 return draconian_breath(player_ptr);
421 case PlayerRaceType::MIND_FLAYER:
422 if (!get_aim_dir(player_ptr, &dir)) {
426 msg_print(_("あなたは集中し、目が赤く輝いた...", "You concentrate and your eyes glow red..."));
427 (void)fire_bolt(player_ptr, AttributeType::PSI, dir, player_ptr->lev);
429 case PlayerRaceType::IMP:
430 if (!get_aim_dir(player_ptr, &dir)) {
434 if (player_ptr->lev >= 30) {
435 msg_print(_("ファイア・ボールを放った。", "You cast a ball of fire."));
436 (void)fire_ball(player_ptr, AttributeType::FIRE, dir, player_ptr->lev, 2);
438 msg_print(_("ファイア・ボルトを放った。", "You cast a bolt of fire."));
439 (void)fire_bolt(player_ptr, AttributeType::FIRE, dir, player_ptr->lev);
443 case PlayerRaceType::GOLEM:
444 (void)set_shield(player_ptr, randint1(20) + 30, false);
446 case PlayerRaceType::SKELETON:
447 case PlayerRaceType::ZOMBIE:
448 msg_print(_("あなたは失ったエネルギーを取り戻そうと試みた。", "You attempt to restore your lost energies."));
449 (void)restore_level(player_ptr);
451 case PlayerRaceType::VAMPIRE:
452 (void)vampirism(player_ptr);
454 case PlayerRaceType::SPECTRE:
455 if (!get_aim_dir(player_ptr, &dir)) {
459 stop_mouth(player_ptr);
460 msg_print(_("あなたはおどろおどろしい叫び声をあげた!", "You emit an eldritch howl!"));
461 (void)fear_monster(player_ptr, dir, player_ptr->lev);
463 case PlayerRaceType::SPRITE:
464 msg_print(_("あなたは魔法の粉を投げつけた...", "You throw some magic dust..."));
465 if (player_ptr->lev < 25) {
466 (void)sleep_monsters_touch(player_ptr);
468 (void)sleep_monsters(player_ptr, player_ptr->lev);
472 case PlayerRaceType::BALROG:
473 return demonic_breath(player_ptr);
474 case PlayerRaceType::KUTAR:
475 (void)set_leveling(player_ptr, randint1(20) + 30, false);
477 case PlayerRaceType::ANDROID:
478 return android_inside_weapon(player_ptr);
480 msg_print(_("この種族は特殊な能力を持っていません。", "This race has no bonus power."));
481 PlayerEnergy(player_ptr).reset_player_turn();