1 #include "mind/mind-mindcrafter.h"
2 #include "autopick/autopick.h"
3 #include "avatar/avatar.h"
4 #include "core/player-update-types.h"
5 #include "core/window-redrawer.h"
6 #include "effect/attribute-types.h"
7 #include "effect/effect-characteristics.h"
8 #include "effect/effect-processor.h"
9 #include "flavor/flag-inscriptions-table.h"
10 #include "flavor/flavor-describer.h"
11 #include "flavor/object-flavor-types.h"
12 #include "floor/floor-object.h"
13 #include "game-option/auto-destruction-options.h"
14 #include "hpmp/hp-mp-processor.h"
15 #include "mind/mind-mindcrafter.h"
16 #include "mind/mind-numbers.h"
17 #include "object-enchant/item-feeling.h"
18 #include "object-enchant/special-object-flags.h"
19 #include "object/item-use-flags.h"
20 #include "object/object-mark-types.h"
21 #include "perception/object-perception.h"
22 #include "perception/simple-perception.h"
23 #include "player/player-status.h"
24 #include "spell-kind/spells-detection.h"
25 #include "spell-kind/spells-fetcher.h"
26 #include "spell-kind/spells-floor.h"
27 #include "spell-kind/spells-launcher.h"
28 #include "spell-kind/spells-perception.h"
29 #include "spell-kind/spells-sight.h"
30 #include "spell-kind/spells-teleport.h"
31 #include "spell/spells-status.h"
32 #include "status/bad-status-setter.h"
33 #include "status/buff-setter.h"
34 #include "status/element-resistance.h"
35 #include "status/sight-setter.h"
36 #include "system/object-type-definition.h"
37 #include "system/player-type-definition.h"
38 #include "target/target-getter.h"
39 #include "util/bit-flags-calculator.h"
40 #include "view/display-messages.h"
43 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
44 * @param player_ptr プレイヤーへの参照ポインタ
46 * currently this function allows pseudo-id of any object,
47 * including silly ones like potions & scrolls, which always
48 * get '{average}'. This should be changed, either to stop such
49 * items from being pseudo-id'd, or to allow psychometry to
50 * detect whether the unidentified potion/scroll/etc is
51 * good (Cure Light Wounds, Restore Strength, etc) or
52 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
54 bool psychometry(PlayerType *player_ptr)
56 concptr q = _("どのアイテムを調べますか?", "Meditate on which item? ");
57 concptr s = _("調べるアイテムがありません。", "You have nothing appropriate.");
60 o_ptr = choose_object(player_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
65 if (o_ptr->is_known()) {
66 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
70 item_feel_type feel = pseudo_value_check_heavy(o_ptr);
71 GAME_TEXT o_name[MAX_NLEN];
72 describe_flavor(player_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
75 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
80 msg_format("%sは%sという感じがする...", o_name, game_inscriptions[feel]);
82 msg_format("You feel that the %s %s %s...", o_name, ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
85 set_bits(o_ptr->ident, IDENT_SENSE);
86 o_ptr->feeling = feel;
87 set_bits(o_ptr->marked, OM_TOUCHED);
89 set_bits(player_ptr->update, PU_COMBINE | PU_REORDER);
90 set_bits(player_ptr->window_flags, PW_INVEN | PW_EQUIP | PW_PLAYER | PW_FLOOR_ITEM_LIST);
93 switch (o_ptr->tval) {
94 case ItemKindType::SHOT:
95 case ItemKindType::ARROW:
96 case ItemKindType::BOLT:
97 case ItemKindType::BOW:
98 case ItemKindType::DIGGING:
99 case ItemKindType::HAFTED:
100 case ItemKindType::POLEARM:
101 case ItemKindType::SWORD:
102 case ItemKindType::BOOTS:
103 case ItemKindType::GLOVES:
104 case ItemKindType::HELM:
105 case ItemKindType::CROWN:
106 case ItemKindType::SHIELD:
107 case ItemKindType::CLOAK:
108 case ItemKindType::SOFT_ARMOR:
109 case ItemKindType::HARD_ARMOR:
110 case ItemKindType::DRAG_ARMOR:
111 case ItemKindType::CARD:
112 case ItemKindType::RING:
113 case ItemKindType::AMULET:
114 case ItemKindType::LITE:
115 case ItemKindType::FIGURINE:
123 autopick_alter_item(player_ptr, item, (bool)(okay && destroy_feeling));
129 * do_cmd_cast calls this function if the player's class is 'mindcrafter'.
130 * @param spell 発動する特殊技能のID
131 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
133 bool cast_mindcrafter_spell(PlayerType *player_ptr, MindMindcrafterType spell)
139 PLAYER_LEVEL plev = player_ptr->lev;
141 case MindMindcrafterType::PRECOGNITION:
143 chg_virtue(player_ptr, V_KNOWLEDGE, 1);
144 chg_virtue(player_ptr, V_ENLIGHTEN, 1);
145 wiz_lite(player_ptr, false);
146 } else if (plev > 19) {
147 map_area(player_ptr, DETECT_RAD_MAP);
151 b = detect_monsters_normal(player_ptr, DETECT_RAD_DEFAULT);
153 b |= detect_monsters_invis(player_ptr, DETECT_RAD_DEFAULT);
156 b |= detect_traps(player_ptr, DETECT_RAD_DEFAULT, true);
157 b |= detect_doors(player_ptr, DETECT_RAD_DEFAULT);
160 b = detect_all(player_ptr, DETECT_RAD_DEFAULT);
163 if ((plev > 24) && (plev < 40)) {
164 set_tim_esp(player_ptr, (TIME_EFFECT)plev, false);
168 msg_print(_("安全な気がする。", "You feel safe."));
172 case MindMindcrafterType::NEURAL_BLAST:
173 if (!get_aim_dir(player_ptr, &dir)) {
177 if (randint1(100) < plev * 2) {
178 fire_beam(player_ptr, AttributeType::PSI, dir, damroll(3 + ((plev - 1) / 4), (3 + plev / 15)));
180 fire_ball(player_ptr, AttributeType::PSI, dir, damroll(3 + ((plev - 1) / 4), (3 + plev / 15)), 0);
183 case MindMindcrafterType::MINOR_DISPLACEMENT:
184 teleport_player(player_ptr, 10, TELEPORT_SPONTANEOUS);
186 case MindMindcrafterType::MAJOR_DISPLACEMENT:
187 teleport_player(player_ptr, plev * 5, TELEPORT_SPONTANEOUS);
189 case MindMindcrafterType::DOMINATION:
191 if (!get_aim_dir(player_ptr, &dir)) {
195 fire_ball(player_ptr, AttributeType::DOMINATION, dir, plev, 0);
197 charm_monsters(player_ptr, plev * 2);
201 case MindMindcrafterType::PLUVERISE:
202 if (!get_aim_dir(player_ptr, &dir)) {
206 fire_ball(player_ptr, AttributeType::TELEKINESIS, dir, damroll(8 + ((plev - 5) / 4), 8), (plev > 20 ? (plev - 20) / 8 + 1 : 0));
208 case MindMindcrafterType::CHARACTER_ARMOR:
209 set_shield(player_ptr, (TIME_EFFECT)plev, false);
211 set_oppose_acid(player_ptr, (TIME_EFFECT)plev, false);
214 set_oppose_fire(player_ptr, (TIME_EFFECT)plev, false);
217 set_oppose_cold(player_ptr, (TIME_EFFECT)plev, false);
220 set_oppose_elec(player_ptr, (TIME_EFFECT)plev, false);
223 set_oppose_pois(player_ptr, (TIME_EFFECT)plev, false);
227 case MindMindcrafterType::PSYCHOMETRY:
229 return psychometry(player_ptr);
231 return ident_spell(player_ptr, false);
233 case MindMindcrafterType::MIND_WAVE:
234 msg_print(_("精神を捻じ曲げる波動を発生させた!", "Mind-warping forces emanate from your brain!"));
236 project(player_ptr, 0, 2 + plev / 10, player_ptr->y, player_ptr->x, (plev * 3), AttributeType::PSI, PROJECT_KILL);
238 (void)mindblast_monsters(player_ptr, randint1(plev * ((plev - 5) / 10 + 1)));
242 case MindMindcrafterType::ADRENALINE_CHANNELING: {
243 BadStatusSetter bss(player_ptr);
244 (void)bss.set_fear(0);
245 (void)bss.set_stun(0);
246 if (!is_fast(player_ptr) || !is_hero(player_ptr)) {
247 hp_player(player_ptr, plev);
250 t = 10 + randint1((plev * 3) / 2);
251 set_hero(player_ptr, t, false);
252 (void)set_acceleration(player_ptr, t, false);
255 case MindMindcrafterType::TELEKINESIS:
256 if (!get_aim_dir(player_ptr, &dir)) {
260 fetch_item(player_ptr, dir, plev * 15, false);
262 case MindMindcrafterType::PSYCHIC_DRAIN:
263 if (!get_aim_dir(player_ptr, &dir)) {
267 dam = damroll(plev / 2, 6);
268 if (fire_ball(player_ptr, AttributeType::PSI_DRAIN, dir, dam, 0)) {
269 player_ptr->energy_need += randint1(150);
273 case MindMindcrafterType::PSYCHO_SPEAR:
274 if (!get_aim_dir(player_ptr, &dir)) {
278 fire_beam(player_ptr, AttributeType::PSY_SPEAR, dir, randint1(plev * 3) + plev * 3);
280 case MindMindcrafterType::THE_WORLD:
281 time_walk(player_ptr);
284 msg_print(_("なに?", "Zap?"));