3 * @brief 魔法効果の実装/ Spell code (part 2)
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
14 #include "spell/spells2.h"
15 #include "autopick/autopick.h"
16 #include "cmd-action/cmd-attack.h"
17 #include "cmd-action/cmd-pet.h"
18 #include "cmd-io/cmd-dump.h"
19 #include "combat/combat-options-type.h"
20 #include "core/stuff-handler.h"
21 #include "dungeon/dungeon.h"
22 #include "dungeon/quest.h"
23 #include "effect/effect-characteristics.h"
24 #include "effect/spells-effect-util.h"
25 #include "floor/floor-events.h"
26 #include "floor/floor-object.h"
27 #include "grid/feature.h"
28 #include "grid/grid.h"
29 #include "inventory/player-inventory.h"
30 #include "io/targeting.h"
31 #include "io/write-diary.h"
32 #include "locale/english.h"
33 #include "main/sound-definitions-table.h"
34 #include "monster/creature.h"
35 #include "monster/monster-race.h"
36 #include "monster/monster-status.h"
37 #include "mutation/mutation.h"
38 #include "object-enchant/artifact.h"
39 #include "object-enchant/item-feeling.h"
40 #include "object/item-use-flags.h"
41 #include "perception/object-perception.h"
42 #include "object/object-flavor.h"
43 #include "object/object-generator.h"
44 #include "object/object-kind-hook.h"
45 #include "object/object-mark-types.h"
46 #include "object-enchant/special-object-flags.h"
47 #include "pet/pet-fall-off.h"
48 #include "pet/pet-util.h"
49 #include "perception/simple-perception.h"
50 #include "player/avatar.h"
51 #include "player/player-class.h"
52 #include "player/player-damage.h"
53 #include "player/player-effects.h"
54 #include "player/player-move.h"
55 #include "player/player-skill.h"
56 #include "player/player-status.h"
57 #include "spell/process-effect.h"
58 #include "spell/spells-diceroll.h"
59 #include "spell/spells-floor.h"
60 #include "spell/spells-status.h"
61 #include "spell/spells-summon.h"
62 #include "spell/spells-type.h"
63 #include "spell/range-calc.h"
64 #include "spell/spells3.h"
65 #include "sv-definition/sv-food-types.h"
66 #include "system/system-variables.h"
67 #include "util/util.h"
68 #include "view/display-main-window.h"
69 #include "world/world.h"
71 #define SV_WOODEN_STATUE 0
74 * @brief 視界内モンスターに魔法効果を与える / Apply a "project()" directly to all viewable monsters
77 * @return 効力があった場合TRUEを返す
80 * Note that affected monsters are NOT auto-tracked by this usage.
82 * To avoid misbehavior when monster deaths have side-effects,
83 * this is done in two passes. -- JDL
86 bool project_all_los(player_type *caster_ptr, EFFECT_ID typ, HIT_POINT dam)
88 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
90 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
91 if (!monster_is_valid(m_ptr)) continue;
93 POSITION y = m_ptr->fy;
94 POSITION x = m_ptr->fx;
95 if (!player_has_los_bold(caster_ptr, y, x) || !projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)) continue;
97 m_ptr->mflag |= (MFLAG_LOS);
100 BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
101 bool obvious = FALSE;
102 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
104 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
105 if (!(m_ptr->mflag & (MFLAG_LOS))) continue;
107 m_ptr->mflag &= ~(MFLAG_LOS);
108 POSITION y = m_ptr->fy;
109 POSITION x = m_ptr->fx;
111 if (project(caster_ptr, 0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
119 * @brief 視界内モンスターを加速する処理 / Speed monsters
120 * @param caster_ptr プレーヤーへの参照ポインタ
121 * @return 効力があった場合TRUEを返す
123 bool speed_monsters(player_type *caster_ptr)
125 return (project_all_los(caster_ptr, GF_OLD_SPEED, caster_ptr->lev));
130 * @brief 視界内モンスターを加速する処理 / Slow monsters
131 * @param caster_ptr プレーヤーへの参照ポインタ
132 * @return 効力があった場合TRUEを返す
134 bool slow_monsters(player_type *caster_ptr, int power)
136 return (project_all_los(caster_ptr, GF_OLD_SLOW, power));
141 * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
142 * @param caster_ptr プレーヤーへの参照ポインタ
143 * @return 効力があった場合TRUEを返す
145 bool sleep_monsters(player_type *caster_ptr, int power)
147 return (project_all_los(caster_ptr, GF_OLD_SLEEP, power));
152 * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
153 * @param caster_ptr プレーヤーへの参照ポインタ
154 * @return 効力があった場合TRUEを返す
156 bool banish_evil(player_type *caster_ptr, int dist)
158 return (project_all_los(caster_ptr, GF_AWAY_EVIL, dist));
163 * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
164 * @return 効力があった場合TRUEを返す
166 bool turn_undead(player_type *caster_ptr)
168 bool tester = (project_all_los(caster_ptr, GF_TURN_UNDEAD, caster_ptr->lev));
170 chg_virtue(caster_ptr, V_UNLIFE, -1);
176 * @brief 視界内のアンデッド・モンスターにダメージを与える処理 / Dispel undead monsters
177 * @param caster_ptr プレーヤーへの参照ポインタ
178 * @return 効力があった場合TRUEを返す
180 bool dispel_undead(player_type *caster_ptr, HIT_POINT dam)
182 bool tester = (project_all_los(caster_ptr, GF_DISP_UNDEAD, dam));
184 chg_virtue(caster_ptr, V_UNLIFE, -2);
190 * @brief 視界内の邪悪なモンスターにダメージを与える処理 / Dispel evil monsters
191 * @param caster_ptr プレーヤーへの参照ポインタ
192 * @return 効力があった場合TRUEを返す
194 bool dispel_evil(player_type *caster_ptr, HIT_POINT dam)
196 return (project_all_los(caster_ptr, GF_DISP_EVIL, dam));
201 * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
202 * @param caster_ptr プレーヤーへの参照ポインタ
203 * @return 効力があった場合TRUEを返す
205 bool dispel_good(player_type *caster_ptr, HIT_POINT dam)
207 return (project_all_los(caster_ptr, GF_DISP_GOOD, dam));
212 * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
213 * @param caster_ptr プレーヤーへの参照ポインタ
214 * @return 効力があった場合TRUEを返す
216 bool dispel_monsters(player_type *caster_ptr, HIT_POINT dam)
218 return (project_all_los(caster_ptr, GF_DISP_ALL, dam));
223 * todo ここにこれがあるのは少し違和感、spells-staffonlyとかに分離したい
225 * @param creature_ptr プレーヤーへの参照ポインタ
226 * @magic 魔法の効果である場合TRUE (杖と同じ効果の呪文はあったか? 要調査)
227 * @powerful 効果が増強される時TRUE (TRUEになるタイミングはあるか? 要調査)
229 bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful)
232 if (dispel_evil(creature_ptr, powerful ? 225 : 150)) ident = TRUE;
233 int k = 3 * creature_ptr->lev;
234 if (set_protevil(creature_ptr, (magic ? 0 : creature_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
235 if (set_poisoned(creature_ptr, 0)) ident = TRUE;
236 if (set_afraid(creature_ptr, 0)) ident = TRUE;
237 if (hp_player(creature_ptr, 50)) ident = TRUE;
238 if (set_stun(creature_ptr, 0)) ident = TRUE;
239 if (set_cut(creature_ptr, 0)) ident = TRUE;
245 * todo ここにこれがあるのは少し違和感、spells-staffonlyとかに分離したい
247 * @param creature_ptr プレーヤーへの参照ポインタ
248 * @powerful 効果が増強される時TRUE (TRUEになるタイミングはあるか? 要調査)
250 bool unleash_mana_storm(player_type *creature_ptr, bool powerful)
252 msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!"));
253 project(creature_ptr, 0, (powerful ? 7 : 5), creature_ptr->y, creature_ptr->x,
254 (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
256 bool is_special_class = creature_ptr->pclass != CLASS_MAGE;
257 is_special_class &= creature_ptr->pclass != CLASS_HIGH_MAGE;
258 is_special_class &= creature_ptr->pclass != CLASS_SORCERER;
259 is_special_class &= creature_ptr->pclass != CLASS_MAGIC_EATER;
260 is_special_class &= creature_ptr->pclass != CLASS_BLUE_MAGE;
261 if (is_special_class)
263 (void)take_hit(creature_ptr, DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
271 * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
272 * @param caster_ptr プレーヤーへの参照ポインタ
273 * @return 効力があった場合TRUEを返す
275 bool dispel_living(player_type *caster_ptr, HIT_POINT dam)
277 return (project_all_los(caster_ptr, GF_DISP_LIVING, dam));
282 * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
283 * @param caster_ptr プレーヤーへの参照ポインタ
284 * @return 効力があった場合TRUEを返す
286 bool dispel_demons(player_type *caster_ptr, HIT_POINT dam)
288 return (project_all_los(caster_ptr, GF_DISP_DEMON, dam));
293 * @brief 視界内のモンスターに「聖戦」効果を与える処理
294 * @param caster_ptr プレーヤーへの参照ポインタ
295 * @return 効力があった場合TRUEを返す
297 bool crusade(player_type *caster_ptr)
299 return (project_all_los(caster_ptr, GF_CRUSADE, caster_ptr->lev * 4));
304 * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
305 * @param caster_ptr プレーヤーへの参照ポインタ
306 * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
309 void aggravate_monsters(player_type *caster_ptr, MONSTER_IDX who)
313 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
315 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
316 if (!monster_is_valid(m_ptr)) continue;
317 if (i == who) continue;
319 if (m_ptr->cdis < MAX_SIGHT * 2)
321 if (MON_CSLEEP(m_ptr))
323 (void)set_monster_csleep(caster_ptr, i, 0);
327 if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
330 if (player_has_los_bold(caster_ptr, m_ptr->fy, m_ptr->fx))
334 (void)set_monster_fast(caster_ptr, i, MON_FAST(m_ptr) + 100);
340 if (speed) msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
341 else if (sleep) msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
342 if (caster_ptr->riding) caster_ptr->update |= PU_BONUS;
347 * @brief モンスターへの単体抹殺処理サブルーチン / Delete a non-unique/non-quest monster
348 * @param m_idx 抹殺するモンスターID
350 * @param player_cast プレイヤーの魔法によるものならば TRUE
351 * @param dam_side プレイヤーへの負担ダメージ量(1d(dam_side))
352 * @param spell_name 抹殺効果を起こした魔法の名前
353 * @return 効力があった場合TRUEを返す
355 bool genocide_aux(player_type *caster_ptr, MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, concptr spell_name)
357 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx];
358 monster_race *r_ptr = &r_info[m_ptr->r_idx];
359 if (is_pet(m_ptr) && !player_cast) return FALSE;
362 if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
363 else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
364 else if (m_idx == caster_ptr->riding) resist = TRUE;
365 else if ((caster_ptr->current_floor_ptr->inside_quest && !random_quest_number(caster_ptr, caster_ptr->current_floor_ptr->dun_level)) || caster_ptr->current_floor_ptr->inside_arena || caster_ptr->phase_out) resist = TRUE;
366 else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
367 else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
370 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
372 GAME_TEXT m_name[MAX_NLEN];
373 monster_desc(caster_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
374 exe_write_diary(caster_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
377 delete_monster_idx(caster_ptr, m_idx);
380 if (resist && player_cast)
382 bool see_m = is_seen(m_ptr);
383 GAME_TEXT m_name[MAX_NLEN];
384 monster_desc(caster_ptr, m_name, m_ptr, 0);
387 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
390 if (MON_CSLEEP(m_ptr))
392 (void)set_monster_csleep(caster_ptr, m_idx, 0);
395 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
399 if (is_friendly(m_ptr) && !is_pet(m_ptr))
403 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
406 set_hostile(caster_ptr, m_ptr);
409 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
414 take_hit(caster_ptr, DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
417 move_cursor_relative(caster_ptr->y, caster_ptr->x);
418 caster_ptr->redraw |= (PR_HP);
419 caster_ptr->window |= (PW_PLAYER);
420 handle_stuff(caster_ptr);
423 int msec = delay_factor * delay_factor * delay_factor;
424 Term_xtra(TERM_XTRA_DELAY, msec);
431 * @brief モンスターへのシンボル抹殺処理ルーチン / Delete all non-unique/non-quest monsters of a given "type" from the level
433 * @param player_cast プレイヤーの魔法によるものならば TRUE
434 * @return 効力があった場合TRUEを返す
436 bool symbol_genocide(player_type *caster_ptr, int power, bool player_cast)
438 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
439 bool is_special_floor = floor_ptr->inside_quest && !random_quest_number(caster_ptr, floor_ptr->dun_level);
440 is_special_floor |= caster_ptr->current_floor_ptr->inside_arena;
441 is_special_floor |= caster_ptr->phase_out;
442 if (is_special_floor)
444 msg_print(_("何も起きないようだ……", "It seems nothing happen here..."));
449 while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE));
451 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
453 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
454 monster_race *r_ptr = &r_info[m_ptr->r_idx];
455 if (!monster_is_valid(m_ptr)) continue;
456 if (r_ptr->d_char != typ) continue;
458 result |= genocide_aux(caster_ptr, i, power, player_cast, 4, _("抹殺", "Genocide"));
463 chg_virtue(caster_ptr, V_VITALITY, -2);
464 chg_virtue(caster_ptr, V_CHANCE, -1);
472 * @brief モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) monsters
474 * @param player_cast プレイヤーの魔法によるものならば TRUE
475 * @return 効力があった場合TRUEを返す
477 bool mass_genocide(player_type *caster_ptr, int power, bool player_cast)
479 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
480 bool is_special_floor = floor_ptr->inside_quest && !random_quest_number(caster_ptr, floor_ptr->dun_level);
481 is_special_floor |= caster_ptr->current_floor_ptr->inside_arena;
482 is_special_floor |= caster_ptr->phase_out;
483 if (is_special_floor)
489 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
491 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
492 if (!monster_is_valid(m_ptr)) continue;
493 if (m_ptr->cdis > MAX_SIGHT) continue;
495 result |= genocide_aux(caster_ptr, i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
500 chg_virtue(caster_ptr, V_VITALITY, -2);
501 chg_virtue(caster_ptr, V_CHANCE, -1);
509 * @brief アンデッド・モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) undead
511 * @param player_cast プレイヤーの魔法によるものならば TRUE
512 * @return 効力があった場合TRUEを返す
514 bool mass_genocide_undead(player_type *caster_ptr, int power, bool player_cast)
516 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
517 bool is_special_floor = floor_ptr->inside_quest && !random_quest_number(caster_ptr, floor_ptr->dun_level);
518 is_special_floor |= caster_ptr->current_floor_ptr->inside_arena;
519 is_special_floor |= caster_ptr->phase_out;
520 if (is_special_floor)
526 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
528 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
529 monster_race *r_ptr = &r_info[m_ptr->r_idx];
530 if (!monster_is_valid(m_ptr)) continue;
531 if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
532 if (m_ptr->cdis > MAX_SIGHT) continue;
534 result |= genocide_aux(caster_ptr, i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
539 chg_virtue(caster_ptr, V_UNLIFE, -2);
540 chg_virtue(caster_ptr, V_CHANCE, -1);
548 * @brief 周辺モンスターを調査する / Probe nearby monsters
549 * @return 効力があった場合TRUEを返す
551 bool probing(player_type *caster_ptr)
553 bool cu = Term->scr->cu;
554 bool cv = Term->scr->cv;
562 for (int i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
564 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
565 monster_race *r_ptr = &r_info[m_ptr->r_idx];
566 if (!monster_is_valid(m_ptr)) continue;
567 if (!player_has_los_bold(caster_ptr, m_ptr->fy, m_ptr->fx)) continue;
568 if (!m_ptr->ml) continue;
570 GAME_TEXT m_name[MAX_NLEN];
571 if (!probe) msg_print(_("調査中...", "Probing..."));
574 if (!is_original_ap(m_ptr))
576 if (m_ptr->mflag2 & MFLAG2_KAGE)
577 m_ptr->mflag2 &= ~(MFLAG2_KAGE);
579 m_ptr->ap_r_idx = m_ptr->r_idx;
580 lite_spot(caster_ptr, m_ptr->fy, m_ptr->fx);
583 monster_desc(caster_ptr, m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
584 speed = m_ptr->mspeed - 110;
585 if (MON_FAST(m_ptr)) speed += 10;
586 if (MON_SLOW(m_ptr)) speed -= 10;
587 if (ironman_nightmare) speed += 5;
589 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
590 else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
591 else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
592 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) align = _("中立(善悪)", "neutral(good&evil)");
593 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
594 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
595 else align = _("中立", "neutral");
597 sprintf(buf, _("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
598 m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
600 if (r_ptr->next_r_idx)
602 strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
609 if (MON_CSLEEP(m_ptr)) strcat(buf, _("睡眠 ", "sleeping "));
610 if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
611 if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
612 if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
613 if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
614 buf[strlen(buf) - 1] = '\0';
618 caster_ptr->window |= (PW_MESSAGE);
619 handle_stuff(caster_ptr);
620 move_cursor_relative(m_ptr->fy, m_ptr->fx);
622 Term_erase(0, 0, 255);
623 if (lore_do_probe(caster_ptr, m_ptr->r_idx))
625 strcpy(buf, (r_name + r_ptr->name));
627 msg_format("%sについてさらに詳しくなった気がする。", buf);
630 msg_format("You now know more about %s.", buf);
644 chg_virtue(caster_ptr, V_KNOWLEDGE, 1);
645 msg_print(_("これで全部です。", "That's all."));
656 void discharge_minion(player_type *caster_ptr)
659 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
661 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
662 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
663 if (m_ptr->nickname) okay = FALSE;
666 if (!okay || caster_ptr->riding)
668 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
672 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
674 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
675 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
678 r_ptr = &r_info[m_ptr->r_idx];
679 if (r_ptr->flags1 & RF1_UNIQUE)
681 GAME_TEXT m_name[MAX_NLEN];
682 monster_desc(caster_ptr, m_name, m_ptr, 0x00);
683 msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists being blasted and runs away."), m_name);
684 delete_monster_idx(caster_ptr, i);
688 HIT_POINT dam = m_ptr->maxhp / 2;
689 if (dam > 100) dam = (dam - 100) / 2 + 100;
690 if (dam > 400) dam = (dam - 400) / 2 + 400;
691 if (dam > 800) dam = 800;
692 project(caster_ptr, i, 2 + (r_ptr->level / 20), m_ptr->fy, m_ptr->fx, dam, GF_PLASMA,
693 PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
695 if (record_named_pet && m_ptr->nickname)
697 GAME_TEXT m_name[MAX_NLEN];
699 monster_desc(caster_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
700 exe_write_diary(caster_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
703 delete_monster_idx(caster_ptr, i);
709 * todo この辺、xとyが引数になっているが、caster_ptr->xとcaster_ptr->yで全て置き換えが効くはず……
710 * @brief 部屋全体を照らすサブルーチン
711 * @param caster_ptr プレーヤーへの参照ポインタ
715 * This routine clears the entire "temp" set.
716 * This routine will Perma-Lite all "temp" grids.
717 * This routine is used (only) by "lite_room()"
718 * Dark grids are illuminated.
719 * Also, process all affected monsters.
721 * SMART monsters always wake up when illuminated
722 * NORMAL monsters wake up 1/4 the time when illuminated
723 * STUPID monsters wake up 1/10 the time when illuminated
726 static void cave_temp_room_lite(player_type *caster_ptr)
728 for (int i = 0; i < tmp_pos.n; i++)
730 POSITION y = tmp_pos.y[i];
731 POSITION x = tmp_pos.x[i];
732 grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
733 g_ptr->info &= ~(CAVE_TEMP);
734 g_ptr->info |= (CAVE_GLOW);
737 PERCENTAGE chance = 25;
738 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
739 monster_race *r_ptr = &r_info[m_ptr->r_idx];
740 update_monster(caster_ptr, g_ptr->m_idx, FALSE);
741 if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
742 if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
744 if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
746 (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
749 GAME_TEXT m_name[MAX_NLEN];
750 monster_desc(caster_ptr, m_name, m_ptr, 0);
751 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
756 note_spot(caster_ptr, y, x);
757 lite_spot(caster_ptr, y, x);
758 update_local_illumination(caster_ptr, y, x);
766 * todo この辺、xとyが引数になっているが、caster_ptr->xとcaster_ptr->yで全て置き換えが効くはず……
767 * @brief 部屋全体を暗くするサブルーチン
768 * @param caster_ptr プレーヤーへの参照ポインタ
772 * This routine clears the entire "temp" set.
773 * This routine will "darken" all "temp" grids.
774 * In addition, some of these grids will be "unmarked".
775 * This routine is used (only) by "unlite_room()"
776 * Also, process all affected monsters
779 static void cave_temp_room_unlite(player_type *caster_ptr)
781 for (int i = 0; i < tmp_pos.n; i++)
783 POSITION y = tmp_pos.y[i];
784 POSITION x = tmp_pos.x[i];
785 grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
786 bool do_dark = !is_mirror_grid(g_ptr);
787 g_ptr->info &= ~(CAVE_TEMP);
788 if (!do_dark) continue;
790 if (caster_ptr->current_floor_ptr->dun_level || !is_daytime())
792 for (int j = 0; j < 9; j++)
794 POSITION by = y + ddy_ddd[j];
795 POSITION bx = x + ddx_ddd[j];
797 if (in_bounds2(caster_ptr->current_floor_ptr, by, bx))
799 grid_type *cc_ptr = &caster_ptr->current_floor_ptr->grid_array[by][bx];
801 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
809 if (!do_dark) continue;
812 g_ptr->info &= ~(CAVE_GLOW);
813 if (!have_flag(f_info[get_feat_mimic(g_ptr)].flags, FF_REMEMBER))
815 if (!view_torch_grids) g_ptr->info &= ~(CAVE_MARK);
816 note_spot(caster_ptr, y, x);
821 update_monster(caster_ptr, g_ptr->m_idx, FALSE);
824 lite_spot(caster_ptr, y, x);
825 update_local_illumination(caster_ptr, y, x);
833 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
834 * @param floor_ptr 配置するフロアの参照ポインタ
837 * @param pass_bold 地形条件を返す関数ポインタ
840 static int next_to_open(floor_type *floor_ptr, POSITION cy, POSITION cx, bool(*pass_bold)(floor_type*, POSITION, POSITION))
844 for (int i = 0; i < 16; i++)
846 POSITION y = cy + ddy_cdd[i % 8];
847 POSITION x = cx + ddx_cdd[i % 8];
848 if (!pass_bold(floor_ptr, y, x))
863 return MAX(len, blen);
868 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
869 * @param floor_ptr 配置するフロアの参照ポインタ
872 * @param pass_bold 地形条件を返す関数ポインタ
875 static int next_to_walls_adj(floor_type *floor_ptr, POSITION cy, POSITION cx, bool(*pass_bold)(floor_type*, POSITION, POSITION))
879 for (DIRECTION i = 0; i < 8; i++)
884 if (!pass_bold(floor_ptr, y, x)) c++;
892 * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数tmp_pos.nに返す / Aux function -- see below
893 * @param caster_ptr プレーヤーへの参照ポインタ
896 * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
897 * @param pass_bold 地形条件を返す関数ポインタ
900 static void cave_temp_room_aux(player_type *caster_ptr, POSITION y, POSITION x, bool only_room, bool(*pass_bold)(floor_type*, POSITION, POSITION))
903 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
904 g_ptr = &floor_ptr->grid_array[y][x];
905 if (g_ptr->info & (CAVE_TEMP)) return;
907 if (!(g_ptr->info & (CAVE_ROOM)))
909 if (only_room) return;
910 if (!in_bounds2(floor_ptr, y, x)) return;
911 if (distance(caster_ptr->y, caster_ptr->x, y, x) > MAX_RANGE) return;
913 /* Verify this grid */
915 * The reason why it is ==6 instead of >5 is that 8 is impossible
916 * due to the check for cave_bold above.
917 * 7 lights dead-end corridors (you need to do this for the
918 * checkboard interesting rooms, so that the boundary is lit
920 * This leaves only a check for 6 bounding walls!
922 if (in_bounds(floor_ptr, y, x) && pass_bold(floor_ptr, y, x) &&
923 (next_to_walls_adj(floor_ptr, y, x, pass_bold) == 6) && (next_to_open(floor_ptr, y, x, pass_bold) <= 1)) return;
926 if (tmp_pos.n == TEMP_MAX) return;
928 g_ptr->info |= (CAVE_TEMP);
929 tmp_pos.y[tmp_pos.n] = y;
930 tmp_pos.x[tmp_pos.n] = x;
936 * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
937 * @param caster_ptr プレーヤーへの参照ポインタ
942 static void cave_temp_lite_room_aux(player_type *caster_ptr, POSITION y, POSITION x)
944 cave_temp_room_aux(caster_ptr, y, x, FALSE, cave_los_bold);
949 * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
950 * @param floor_ptr 配置するフロアの参照ポインタ
953 * @return 射線を通すならばtrueを返す。
955 static bool cave_pass_dark_bold(floor_type *floor_ptr, POSITION y, POSITION x)
957 return cave_have_flag_bold(floor_ptr, y, x, FF_PROJECT);
962 * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
963 * @param caster_ptr プレーヤーへの参照ポインタ
968 static void cave_temp_unlite_room_aux(player_type *caster_ptr, POSITION y, POSITION x)
970 cave_temp_room_aux(caster_ptr, y, x, TRUE, cave_pass_dark_bold);
975 * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
976 * @param caster_ptr プレーヤーへの参照ポインタ
981 void lite_room(player_type *caster_ptr, POSITION y1, POSITION x1)
983 cave_temp_lite_room_aux(caster_ptr, y1, x1);
984 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
985 for (int i = 0; i < tmp_pos.n; i++)
987 POSITION x = tmp_pos.x[i];
988 POSITION y = tmp_pos.y[i];
990 if (!cave_los_bold(floor_ptr, y, x)) continue;
992 cave_temp_lite_room_aux(caster_ptr, y + 1, x);
993 cave_temp_lite_room_aux(caster_ptr, y - 1, x);
994 cave_temp_lite_room_aux(caster_ptr, y, x + 1);
995 cave_temp_lite_room_aux(caster_ptr, y, x - 1);
997 cave_temp_lite_room_aux(caster_ptr, y + 1, x + 1);
998 cave_temp_lite_room_aux(caster_ptr, y - 1, x - 1);
999 cave_temp_lite_room_aux(caster_ptr, y - 1, x + 1);
1000 cave_temp_lite_room_aux(caster_ptr, y + 1, x - 1);
1003 cave_temp_room_lite(caster_ptr);
1004 if (caster_ptr->special_defense & NINJA_S_STEALTH)
1006 if (floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].info & CAVE_GLOW)
1007 set_superstealth(caster_ptr, FALSE);
1013 * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
1014 * @param caster_ptr プレーヤーへの参照ポインタ
1019 void unlite_room(player_type *caster_ptr, POSITION y1, POSITION x1)
1021 cave_temp_unlite_room_aux(caster_ptr, y1, x1);
1022 for (int i = 0; i < tmp_pos.n; i++)
1024 POSITION x = tmp_pos.x[i];
1025 POSITION y = tmp_pos.y[i];
1026 if (!cave_pass_dark_bold(caster_ptr->current_floor_ptr, y, x)) continue;
1028 cave_temp_unlite_room_aux(caster_ptr, y + 1, x);
1029 cave_temp_unlite_room_aux(caster_ptr, y - 1, x);
1030 cave_temp_unlite_room_aux(caster_ptr, y, x + 1);
1031 cave_temp_unlite_room_aux(caster_ptr, y, x - 1);
1033 cave_temp_unlite_room_aux(caster_ptr, y + 1, x + 1);
1034 cave_temp_unlite_room_aux(caster_ptr, y - 1, x - 1);
1035 cave_temp_unlite_room_aux(caster_ptr, y - 1, x + 1);
1036 cave_temp_unlite_room_aux(caster_ptr, y + 1, x - 1);
1039 cave_temp_room_unlite(caster_ptr);
1044 * @brief スターライトの効果を発生させる
1045 * @param caster_ptr プレーヤーへの参照ポインタ
1046 * @param magic 魔法による効果であればTRUE、スターライトの杖による効果であればFALSE
1049 bool starlight(player_type *caster_ptr, bool magic)
1051 if (!caster_ptr->blind && !magic)
1053 msg_print(_("杖の先が明るく輝いた...", "The end of the staff glows brightly..."));
1056 HIT_POINT num = damroll(5, 3);
1058 POSITION y = 0, x = 0;
1059 for (int k = 0; k < num; k++)
1065 scatter(caster_ptr, &y, &x, caster_ptr->y, caster_ptr->x, 4, PROJECT_LOS);
1066 if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT)) continue;
1067 if (!player_bold(caster_ptr, y, x)) break;
1070 project(caster_ptr, 0, 0, y, x, damroll(6 + caster_ptr->lev / 8, 10), GF_LITE_WEAK,
1071 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL | PROJECT_LOS), -1);
1079 * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
1080 * @param caster_ptr プレーヤーへの参照ポインタ
1083 * @return 作用が実際にあった場合TRUEを返す
1085 bool lite_area(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
1087 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS)
1089 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorbs your light."));
1093 if (!caster_ptr->blind)
1095 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
1098 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
1099 (void)project(caster_ptr, 0, rad, caster_ptr->y, caster_ptr->x, dam, GF_LITE_WEAK, flg, -1);
1101 lite_room(caster_ptr, caster_ptr->y, caster_ptr->x);
1108 * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
1109 * @param caster_ptr プレーヤーへの参照ポインタ
1112 * @return 作用が実際にあった場合TRUEを返す
1114 bool unlite_area(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
1116 if (!caster_ptr->blind)
1118 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
1121 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
1122 (void)project(caster_ptr, 0, rad, caster_ptr->y, caster_ptr->x, dam, GF_DARK_WEAK, flg, -1);
1124 unlite_room(caster_ptr, caster_ptr->y, caster_ptr->x);
1131 * @brief ボール系スペルの発動 / Cast a ball spell
1132 * @param caster_ptr プレーヤーへの参照ポインタ
1134 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1137 * @return 作用が実際にあった場合TRUEを返す
1140 * Stop if we hit a monster, act as a "ball"
1141 * Allow "target" mode to pass over monsters
1142 * Affect grids, objects, and monsters
1145 bool fire_ball(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
1147 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1148 if (typ == GF_CHARM_LIVING) flg |= PROJECT_HIDE;
1150 POSITION tx = caster_ptr->x + 99 * ddx[dir];
1151 POSITION ty = caster_ptr->y + 99 * ddy[dir];
1153 if ((dir == 5) && target_okay(caster_ptr))
1155 flg &= ~(PROJECT_STOP);
1160 return project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1);
1165 * @brief ブレス系スペルの発動 / Cast a breath spell
1166 * @param caster_ptr プレーヤーへの参照ポインタ
1168 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1171 * @return 作用が実際にあった場合TRUEを返す
1174 * Stop if we hit a monster, act as a "ball"
1175 * Allow "target" mode to pass over monsters
1176 * Affect grids, objects, and monsters
1179 bool fire_breath(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
1181 return fire_ball(caster_ptr, typ, dir, dam, -rad);
1186 * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
1187 * @param caster_ptr プレーヤーへの参照ポインタ
1189 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1192 * @return 作用が実際にあった場合TRUEを返す
1195 * Stop if we hit a monster, act as a "ball"
1196 * Allow "target" mode to pass over monsters
1197 * Affect grids, objects, and monsters
1200 bool fire_rocket(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
1202 POSITION tx = caster_ptr->x + 99 * ddx[dir];
1203 POSITION ty = caster_ptr->y + 99 * ddy[dir];
1204 if ((dir == 5) && target_okay(caster_ptr))
1210 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1211 return (project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1));
1216 * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
1217 * @param caster_ptr プレーヤーへの参照ポインタ
1219 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1222 * @return 作用が実際にあった場合TRUEを返す
1225 * Stop if we hit a monster, act as a "ball"
1226 * Allow "target" mode to pass over monsters
1227 * Affect grids, objects, and monsters
1230 bool fire_ball_hide(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
1232 POSITION tx = caster_ptr->x + 99 * ddx[dir];
1233 POSITION ty = caster_ptr->y + 99 * ddy[dir];
1234 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
1235 if ((dir == 5) && target_okay(caster_ptr))
1237 flg &= ~(PROJECT_STOP);
1242 return (project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1));
1247 * @brief メテオ系スペルの発動 / Cast a meteor spell
1248 * @param caster_ptr プレーヤーへの参照ポインタ
1249 * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
1255 * @return 作用が実際にあった場合TRUEを返す
1258 * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
1259 * player, or outside source, that starts out at an arbitrary location, and
1260 * leaving no trail from the "caster" to the target. This function is
1261 * especially useful for bombardments and similar. -LM-
1262 * Option to hurt the player.
1265 bool fire_meteor(player_type *caster_ptr, MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
1267 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1268 return (project(caster_ptr, who, rad, y, x, dam, typ, flg, -1));
1273 * @brief ブラスト系スペルの発動 / Cast a blast spell
1274 * @param caster_ptr プレーヤーへの参照ポインタ
1276 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1281 * @return 作用が実際にあった場合TRUEを返す
1283 bool fire_blast(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, DICE_NUMBER dd, DICE_SID ds, int num, int dev)
1285 POSITION ty, tx, y, x;
1292 lx = 20 * (tx - caster_ptr->x) + caster_ptr->x;
1293 ly = 20 * (ty - caster_ptr->y) + caster_ptr->y;
1297 ly = ty = caster_ptr->y + 20 * ddy[dir];
1298 lx = tx = caster_ptr->x + 20 * ddx[dir];
1301 int ld = distance(caster_ptr->y, caster_ptr->x, ly, lx);
1302 BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
1304 for (int i = 0; i < num; i++)
1308 /* Get targets for some bolts */
1309 y = rand_spread(ly, ld * dev / 20);
1310 x = rand_spread(lx, ld * dev / 20);
1312 if (distance(ly, lx, y, x) <= ld * dev / 20) break;
1315 /* Analyze the "dir" and the "target". */
1316 if (!project(caster_ptr, 0, 0, y, x, damroll(dd, ds), typ, flg, -1))
1327 * @brief モンスターとの位置交換処理 / Switch position with a monster.
1328 * @param caster_ptr プレーヤーへの参照ポインタ
1329 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1330 * @return 作用が実際にあった場合TRUEを返す
1332 bool teleport_swap(player_type *caster_ptr, DIRECTION dir)
1335 if ((dir == 5) && target_okay(caster_ptr))
1342 tx = caster_ptr->x + ddx[dir];
1343 ty = caster_ptr->y + ddy[dir];
1346 if (caster_ptr->anti_tele)
1348 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
1353 g_ptr = &caster_ptr->current_floor_ptr->grid_array[ty][tx];
1354 if (!g_ptr->m_idx || (g_ptr->m_idx == caster_ptr->riding))
1356 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
1360 if ((g_ptr->info & CAVE_ICKY) || (distance(ty, tx, caster_ptr->y, caster_ptr->x) > caster_ptr->lev * 3 / 2 + 10))
1362 msg_print(_("失敗した。", "Failed to swap."));
1366 monster_type* m_ptr;
1367 monster_race* r_ptr;
1368 m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
1369 r_ptr = &r_info[m_ptr->r_idx];
1371 (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
1373 if (r_ptr->flagsr & RFR_RES_TELE)
1375 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
1376 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1380 sound(SOUND_TELEPORT);
1381 (void)move_player_effect(caster_ptr, ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
1387 * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "project()" in a direction (or at the target)
1388 * @param caster_ptr プレーヤーへの参照ポインタ
1390 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1393 * @return 作用が実際にあった場合TRUEを返す
1395 bool project_hook(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
1397 flg |= (PROJECT_THRU);
1398 POSITION tx = caster_ptr->x + ddx[dir];
1399 POSITION ty = caster_ptr->y + ddy[dir];
1400 if ((dir == 5) && target_okay(caster_ptr))
1406 return (project(caster_ptr, 0, 0, ty, tx, dam, typ, flg, -1));
1411 * @brief ボルト系スペルの発動 / Cast a bolt spell.
1412 * @param caster_ptr プレーヤーへの参照ポインタ
1414 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1416 * @return 作用が実際にあった場合TRUEを返す
1419 * Stop if we hit a monster, as a "bolt".
1420 * Affect monsters and grids (not objects).
1423 bool fire_bolt(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
1425 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
1426 if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
1427 return (project_hook(caster_ptr, typ, dir, dam, flg));
1432 * @brief ビーム系スペルの発動 / Cast a beam spell.
1433 * @param caster_ptr プレーヤーへの参照ポインタ
1435 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1437 * @return 作用が実際にあった場合TRUEを返す
1440 * Pass through monsters, as a "beam".
1441 * Affect monsters, grids and objects.
1444 bool fire_beam(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
1446 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
1447 return (project_hook(caster_ptr, typ, dir, dam, flg));
1452 * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
1453 * @param caster_ptr プレーヤーへの参照ポインタ
1454 * @param prob ビーム化する確率(%)
1456 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1458 * @return 作用が実際にあった場合TRUEを返す
1461 * Pass through monsters, as a "beam".
1462 * Affect monsters, grids and objects.
1465 bool fire_bolt_or_beam(player_type *caster_ptr, PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
1467 if (randint0(100) < prob)
1469 return (fire_beam(caster_ptr, typ, dir, dam));
1472 return (fire_bolt(caster_ptr, typ, dir, dam));
1477 * @brief LITE_WEAK属性による光源ビーム処理
1478 * @param caster_ptr プレーヤーへの参照ポインタ
1479 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1481 * @return 作用が実際にあった場合TRUEを返す
1483 bool lite_line(player_type *caster_ptr, DIRECTION dir, HIT_POINT dam)
1485 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
1486 return (project_hook(caster_ptr, GF_LITE_WEAK, dir, dam, flg));
1492 * @param caster_ptr プレーヤーへの参照ポインタ
1493 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1495 * @return 作用が実際にあった場合TRUEを返す
1497 bool hypodynamic_bolt(player_type *caster_ptr, DIRECTION dir, HIT_POINT dam)
1499 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
1500 return (project_hook(caster_ptr, GF_HYPODYNAMIA, dir, dam, flg));
1506 * @param caster_ptr プレーヤーへの参照ポインタ
1507 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1509 * @return 作用が実際にあった場合TRUEを返す
1511 bool wall_to_mud(player_type *caster_ptr, DIRECTION dir, HIT_POINT dam)
1513 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1514 return (project_hook(caster_ptr, GF_KILL_WALL, dir, dam, flg));
1520 * @param caster_ptr プレーヤーへの参照ポインタ
1521 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1522 * @return 作用が実際にあった場合TRUEを返す
1524 bool wizard_lock(player_type *caster_ptr, DIRECTION dir)
1526 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1527 return (project_hook(caster_ptr, GF_JAM_DOOR, dir, 20 + randint1(30), flg));
1533 * @param caster_ptr プレーヤーへの参照ポインタ
1534 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1535 * @return 作用が実際にあった場合TRUEを返す
1537 bool destroy_door(player_type *caster_ptr, DIRECTION dir)
1539 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
1540 return (project_hook(caster_ptr, GF_KILL_DOOR, dir, 0, flg));
1546 * @param caster_ptr プレーヤーへの参照ポインタ
1547 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1548 * @return 作用が実際にあった場合TRUEを返す
1550 bool disarm_trap(player_type *caster_ptr, DIRECTION dir)
1552 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
1553 return (project_hook(caster_ptr, GF_KILL_TRAP, dir, 0, flg));
1559 * @param caster_ptr プレーヤーへの参照ポインタ
1560 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1561 * @param plev プレイヤーレベル(効力はplev*200)
1562 * @return 作用が実際にあった場合TRUEを返す
1564 bool death_ray(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
1566 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
1567 return (project_hook(caster_ptr, GF_DEATH_RAY, dir, plev * 200, flg));
1572 * @brief モンスター用テレポート処理
1573 * @param caster_ptr プレーヤーへの参照ポインタ
1574 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1575 * @param distance 移動距離
1576 * @return 作用が実際にあった場合TRUEを返す
1578 bool teleport_monster(player_type *caster_ptr, DIRECTION dir, int distance)
1580 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
1581 return (project_hook(caster_ptr, GF_AWAY_ALL, dir, distance, flg));
1586 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
1587 * @param caster_ptr プレーヤーへの参照ポインタ
1588 * @return 作用が実際にあった場合TRUEを返す
1590 bool door_creation(player_type *caster_ptr, POSITION y, POSITION x)
1592 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
1593 return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_DOOR, flg, -1));
1598 * @brief トラップ生成処理(起点から周囲1マス)
1599 * @param caster_ptr プレーヤーへの参照ポインタ
1602 * @return 作用が実際にあった場合TRUEを返す
1604 bool trap_creation(player_type *caster_ptr, POSITION y, POSITION x)
1606 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
1607 return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
1612 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
1613 * @param caster_ptr プレーヤーへの参照ポインタ
1614 * @return 作用が実際にあった場合TRUEを返す
1616 bool tree_creation(player_type *caster_ptr, POSITION y, POSITION x)
1618 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
1619 return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_TREE, flg, -1));
1624 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
1625 * @param caster_ptr プレーヤーへの参照ポインタ
1626 * @return 作用が実際にあった場合TRUEを返す
1628 bool glyph_creation(player_type *caster_ptr, POSITION y, POSITION x)
1630 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
1631 return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_GLYPH, flg, -1));
1636 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
1637 * @param caster_ptr プレーヤーへの参照ポインタ
1638 * @return 作用が実際にあった場合TRUEを返す
1640 bool wall_stone(player_type *caster_ptr)
1642 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
1643 bool dummy = (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, 0, GF_STONE_WALL, flg, -1));
1644 caster_ptr->update |= (PU_FLOW);
1645 caster_ptr->redraw |= (PR_MAP);
1651 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
1652 * @param caster_ptr プレーヤーへの参照ポインタ
1653 * @return 作用が実際にあった場合TRUEを返す
1655 bool destroy_doors_touch(player_type *caster_ptr)
1657 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
1658 return (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, 0, GF_KILL_DOOR, flg, -1));
1663 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
1664 * @param caster_ptr プレーヤーへの参照ポインタ
1665 * @return 作用が実際にあった場合TRUEを返す
1667 bool disarm_traps_touch(player_type *caster_ptr)
1669 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
1670 return (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, 0, GF_KILL_TRAP, flg, -1));
1675 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
1676 * @param caster_ptr プレーヤーへの参照ポインタ
1677 * @return 作用が実際にあった場合TRUEを返す
1679 bool sleep_monsters_touch(player_type *caster_ptr)
1681 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
1682 return (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, caster_ptr->lev, GF_OLD_SLEEP, flg, -1));
1687 * @brief 死者復活処理(起点より周囲5マス)
1688 * @param caster_ptr プレーヤーへの参照ポインタ
1689 * @param who 術者モンスターID(0ならばプレイヤー)
1692 * @return 作用が実際にあった場合TRUEを返す
1694 bool animate_dead(player_type *caster_ptr, MONSTER_IDX who, POSITION y, POSITION x)
1696 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
1697 return (project(caster_ptr, who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
1703 * @return 作用が実際にあった場合TRUEを返す
1705 void call_chaos(player_type *caster_ptr)
1707 int hurt_types[31] =
1709 GF_ELEC, GF_POIS, GF_ACID, GF_COLD,
1710 GF_FIRE, GF_MISSILE, GF_ARROW, GF_PLASMA,
1711 GF_HOLY_FIRE, GF_WATER, GF_LITE, GF_DARK,
1712 GF_FORCE, GF_INERTIAL, GF_MANA, GF_METEOR,
1713 GF_ICE, GF_CHAOS, GF_NETHER, GF_DISENCHANT,
1714 GF_SHARDS, GF_SOUND, GF_NEXUS, GF_CONFUSION,
1715 GF_TIME, GF_GRAVITY, GF_ROCKET, GF_NUKE,
1716 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
1719 int chaos_type = hurt_types[randint0(31)];
1720 bool line_chaos = FALSE;
1721 if (one_in_(4)) line_chaos = TRUE;
1726 for (int dummy = 1; dummy < 10; dummy++)
1731 fire_beam(caster_ptr, chaos_type, dummy, 150);
1733 fire_ball(caster_ptr, chaos_type, dummy, 150, 2);
1742 fire_ball(caster_ptr, chaos_type, 0, 500, 8);
1746 if (!get_aim_dir(caster_ptr, &dir)) return;
1748 fire_beam(caster_ptr, chaos_type, dir, 250);
1750 fire_ball(caster_ptr, chaos_type, dir, 250, 3 + (caster_ptr->lev / 35));
1755 * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
1756 * @param target_ptr プレーヤーへの参照ポインタ
1757 * @param stop_ty 再帰処理停止フラグ
1759 * @return 作用が実際にあった場合TRUEを返す
1762 * rr9: Stop the nasty things when a Cyberdemon is summoned
1763 * or the player gets paralyzed.
1766 bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count)
1768 BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
1769 bool is_first_curse = TRUE;
1770 floor_type *floor_ptr = target_ptr->current_floor_ptr;
1771 while (is_first_curse || (one_in_(3) && !stop_ty))
1773 is_first_curse = FALSE;
1774 switch (randint1(34))
1779 msg_print(_("地面が揺れた...", "The ground trembles..."));
1780 earthquake(target_ptr, target_ptr->y, target_ptr->x, 5 + randint0(10), 0);
1781 if (!one_in_(6)) break;
1787 HIT_POINT dam = damroll(10, 10);
1788 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
1789 project(target_ptr, 0, 8, target_ptr->y, target_ptr->x, dam, GF_MANA, flg, -1);
1790 take_hit(target_ptr, DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
1791 if (!one_in_(6)) break;
1797 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
1798 teleport_player(target_ptr, damroll(10, 10), TELEPORT_PASSIVE);
1799 if (randint0(13)) (*count) += activate_hi_summon(target_ptr, target_ptr->y, target_ptr->x, FALSE);
1800 if (!one_in_(6)) break;
1804 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
1805 wall_breaker(target_ptr);
1808 project(target_ptr, 0, 7, target_ptr->y, target_ptr->x, 50, GF_KILL_WALL, flg, -1);
1809 take_hit(target_ptr, DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
1812 if (!one_in_(6)) break;
1814 case 1: case 2: case 3: case 16: case 17:
1815 aggravate_monsters(target_ptr, 0);
1816 if (!one_in_(6)) break;
1818 case 4: case 5: case 6:
1819 (*count) += activate_hi_summon(target_ptr, target_ptr->y, target_ptr->x, FALSE);
1820 if (!one_in_(6)) break;
1822 case 7: case 8: case 9: case 18:
1823 (*count) += summon_specific(target_ptr, 0, target_ptr->y, target_ptr->x, floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
1824 if (!one_in_(6)) break;
1826 case 10: case 11: case 12:
1827 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
1828 lose_exp(target_ptr, target_ptr->exp / 16);
1829 if (!one_in_(6)) break;
1831 case 13: case 14: case 15: case 19: case 20:
1833 bool is_statue = stop_ty;
1834 is_statue |= target_ptr->free_act && (randint1(125) < target_ptr->skill_sav);
1835 is_statue |= target_ptr->pclass == CLASS_BERSERKER;
1838 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
1839 if (target_ptr->free_act)
1840 set_paralyzed(target_ptr, target_ptr->paralyzed + randint1(3));
1842 set_paralyzed(target_ptr, target_ptr->paralyzed + randint1(13));
1846 if (!one_in_(6)) break;
1849 case 21: case 22: case 23:
1850 (void)do_dec_stat(target_ptr, randint0(6));
1851 if (!one_in_(6)) break;
1854 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
1855 lose_all_info(target_ptr);
1856 if (!one_in_(6)) break;
1859 if ((floor_ptr->dun_level > 65) && !stop_ty)
1861 (*count) += summon_cyber(target_ptr, -1, target_ptr->y, target_ptr->x);
1866 if (!one_in_(6)) break;
1869 for (int i = 0; i < A_MAX; i++)
1871 bool is_first_dec_stat = TRUE;
1872 while (is_first_dec_stat || one_in_(2))
1874 is_first_dec_stat = FALSE;
1875 (void)do_dec_stat(target_ptr, i);
1886 * todo 引数にPOSITION x/yは必要か? 要調査
1887 * @brief HI_SUMMON(上級召喚)処理発動
1888 * @param caster_ptr プレーヤーへの参照ポインタ
1891 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
1892 * @return 作用が実際にあった場合TRUEを返す
1894 int activate_hi_summon(player_type *caster_ptr, POSITION y, POSITION x, bool can_pet)
1896 BIT_FLAGS mode = PM_ALLOW_GROUP;
1902 mode |= PM_FORCE_FRIENDLY;
1906 mode |= PM_FORCE_PET;
1911 if (!pet) mode |= PM_NO_PET;
1913 DEPTH dungeon_level = caster_ptr->current_floor_ptr->dun_level;
1914 DEPTH summon_lev = (pet ? caster_ptr->lev * 2 / 3 + randint1(caster_ptr->lev / 2) : dungeon_level);
1916 for (int i = 0; i < (randint1(7) + (dungeon_level / 40)); i++)
1918 switch (randint1(25) + (dungeon_level / 20))
1921 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
1924 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
1927 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
1930 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
1933 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
1936 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
1939 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
1942 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
1946 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
1950 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
1953 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
1954 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
1957 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
1958 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
1961 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
1964 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
1965 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
1974 * @brief 周辺破壊効果(プレイヤー中心)
1975 * @param caster_ptr プレーヤーへの参照ポインタ
1976 * @return 作用が実際にあった場合TRUEを返す
1978 void wall_breaker(player_type *caster_ptr)
1980 POSITION y = 0, x = 0;
1981 int attempts = 1000;
1982 if (randint1(80 + caster_ptr->lev) < 70)
1986 scatter(caster_ptr, &y, &x, caster_ptr->y, caster_ptr->x, 4, 0);
1988 if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT)) continue;
1990 if (!player_bold(caster_ptr, y, x)) break;
1993 project(caster_ptr, 0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
1994 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
1998 if (randint1(100) > 30)
2000 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 1, 0);
2004 int num = damroll(5, 3);
2005 for (int i = 0; i < num; i++)
2009 scatter(caster_ptr, &y, &x, caster_ptr->y, caster_ptr->x, 10, 0);
2011 if (!player_bold(caster_ptr, y, x)) break;
2014 project(caster_ptr, 0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
2015 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
2021 * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
2022 * @param caster_ptr プレーヤーへの参照ポインタ
2024 * @return 作用が実際にあった場合TRUEを返す
2026 bool confuse_monsters(player_type *caster_ptr, HIT_POINT dam)
2028 return (project_all_los(caster_ptr, GF_OLD_CONF, dam));
2033 * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
2034 * @param caster_ptr プレーヤーへの参照ポインタ
2036 * @return 作用が実際にあった場合TRUEを返す
2038 bool charm_monsters(player_type *caster_ptr, HIT_POINT dam)
2040 return (project_all_los(caster_ptr, GF_CHARM, dam));
2045 * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
2046 * @param caster_ptr プレーヤーへの参照ポインタ
2048 * @return 作用が実際にあった場合TRUEを返す
2050 bool charm_animals(player_type *caster_ptr, HIT_POINT dam)
2052 return (project_all_los(caster_ptr, GF_CONTROL_ANIMAL, dam));
2057 * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
2058 * @param caster_ptr プレーヤーへの参照ポインタ
2060 * @return 作用が実際にあった場合TRUEを返す
2062 bool stun_monsters(player_type *caster_ptr, HIT_POINT dam)
2064 return (project_all_los(caster_ptr, GF_STUN, dam));
2069 * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
2070 * @param caster_ptr プレーヤーへの参照ポインタ
2072 * @return 作用が実際にあった場合TRUEを返す
2074 bool stasis_monsters(player_type *caster_ptr, HIT_POINT dam)
2076 return (project_all_los(caster_ptr, GF_STASIS, dam));
2081 * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
2082 * @param caster_ptr プレーヤーへの参照ポインタ
2084 * @return 作用が実際にあった場合TRUEを返す
2086 bool mindblast_monsters(player_type *caster_ptr, HIT_POINT dam)
2088 return (project_all_los(caster_ptr, GF_PSI, dam));
2093 * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
2094 * @param caster_ptr プレーヤーへの参照ポインタ
2095 * @param dist 効力(距離)
2096 * @return 作用が実際にあった場合TRUEを返す
2098 bool banish_monsters(player_type *caster_ptr, int dist)
2100 return (project_all_los(caster_ptr, GF_AWAY_ALL, dist));
2105 * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
2106 * @param caster_ptr プレーヤーへの参照ポインタ
2108 * @return 作用が実際にあった場合TRUEを返す
2110 bool turn_evil(player_type *caster_ptr, HIT_POINT dam)
2112 return (project_all_los(caster_ptr, GF_TURN_EVIL, dam));
2117 * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
2118 * @param caster_ptr プレーヤーへの参照ポインタ
2120 * @return 作用が実際にあった場合TRUEを返す
2122 bool turn_monsters(player_type *caster_ptr, HIT_POINT dam)
2124 return (project_all_los(caster_ptr, GF_TURN_ALL, dam));
2129 * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
2130 * @param caster_ptr プレーヤーへの参照ポインタ
2131 * @return 作用が実際にあった場合TRUEを返す
2133 bool deathray_monsters(player_type *caster_ptr)
2135 return (project_all_los(caster_ptr, GF_DEATH_RAY, caster_ptr->lev * 200));
2140 * @brief チャーム・モンスター(1体)
2141 * @param caster_ptr プレーヤーへの参照ポインタ
2142 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2144 * @return 作用が実際にあった場合TRUEを返す
2146 bool charm_monster(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
2148 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
2149 return (project_hook(caster_ptr, GF_CHARM, dir, plev, flg));
2154 * @brief アンデッド支配(1体)
2155 * @param caster_ptr プレーヤーへの参照ポインタ
2156 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2158 * @return 作用が実際にあった場合TRUEを返す
2160 bool control_one_undead(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
2162 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
2163 return (project_hook(caster_ptr, GF_CONTROL_UNDEAD, dir, plev, flg));
2169 * @param caster_ptr プレーヤーへの参照ポインタ
2170 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2172 * @return 作用が実際にあった場合TRUEを返す
2174 bool control_one_demon(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
2176 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
2177 return (project_hook(caster_ptr, GF_CONTROL_DEMON, dir, plev, flg));
2183 * @param caster_ptr プレーヤーへの参照ポインタ
2184 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2186 * @return 作用が実際にあった場合TRUEを返す
2188 bool charm_animal(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
2190 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
2191 return (project_hook(caster_ptr, GF_CONTROL_ANIMAL, dir, plev, flg));
2197 * @param caster_ptr プレーヤーへの参照ポインタ
2198 * @param success 判定成功上の処理ならばTRUE
2199 * @return 作用が実際にあった場合TRUEを返す
2201 bool kawarimi(player_type *caster_ptr, bool success)
2204 object_type *q_ptr = &forge;
2206 if (caster_ptr->is_dead) return FALSE;
2207 if (caster_ptr->confused || caster_ptr->blind || caster_ptr->paralyzed || caster_ptr->image) return FALSE;
2208 if (randint0(200) < caster_ptr->stun) return FALSE;
2210 if (!success && one_in_(3))
2212 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
2213 caster_ptr->special_defense &= ~(NINJA_KAWARIMI);
2214 caster_ptr->redraw |= (PR_STATUS);
2218 POSITION y = caster_ptr->y;
2219 POSITION x = caster_ptr->x;
2221 teleport_player(caster_ptr, 10 + randint1(90), TELEPORT_SPONTANEOUS);
2223 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
2225 q_ptr->pval = MON_NINJA;
2226 (void)drop_near(caster_ptr, q_ptr, -1, y, x);
2228 if (success) msg_print(_("攻撃を受ける前に素早く身をひるがえした。", "You have turned around just before the attack hit you."));
2229 else msg_print(_("失敗!攻撃を受けてしまった。", "Failed! You are hit by the attack."));
2231 caster_ptr->special_defense &= ~(NINJA_KAWARIMI);
2232 caster_ptr->redraw |= (PR_STATUS);
2238 * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
2239 * @param caster_ptr プレーヤーへの参照ポインタ
2240 * @param mdeath 目標モンスターが死亡したかを返す
2241 * @return 作用が実際にあった場合TRUEを返す / Return value is for checking "done"
2243 bool rush_attack(player_type *attacker_ptr, bool *mdeath)
2245 if (mdeath) *mdeath = FALSE;
2249 if (!get_aim_dir(attacker_ptr, &dir)) return FALSE;
2251 int tx = attacker_ptr->x + project_length * ddx[dir];
2252 int ty = attacker_ptr->y + project_length * ddy[dir];
2254 if ((dir == 5) && target_okay(attacker_ptr))
2261 floor_type *floor_ptr = attacker_ptr->current_floor_ptr;
2262 if (in_bounds(floor_ptr, ty, tx)) tm_idx = floor_ptr->grid_array[ty][tx].m_idx;
2265 int path_n = project_path(attacker_ptr, path_g, project_length, attacker_ptr->y, attacker_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
2267 if (!path_n) return TRUE;
2269 ty = attacker_ptr->y;
2270 tx = attacker_ptr->x;
2271 bool tmp_mdeath = FALSE;
2273 for (int i = 0; i < path_n; i++)
2275 monster_type *m_ptr;
2277 int ny = GRID_Y(path_g[i]);
2278 int nx = GRID_X(path_g[i]);
2280 if (is_cave_empty_bold(attacker_ptr, ny, nx) && player_can_enter(attacker_ptr, floor_ptr->grid_array[ny][nx].feat, 0))
2287 if (!floor_ptr->grid_array[ny][nx].m_idx)
2291 msg_print(_("失敗!", "Failed!"));
2295 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
2301 if (!player_bold(attacker_ptr, ty, tx)) teleport_player_to(attacker_ptr, ty, tx, TELEPORT_NONMAGICAL);
2302 update_monster(attacker_ptr, floor_ptr->grid_array[ny][nx].m_idx, TRUE);
2304 m_ptr = &floor_ptr->m_list[floor_ptr->grid_array[ny][nx].m_idx];
2305 if (tm_idx != floor_ptr->grid_array[ny][nx].m_idx)
2308 msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "", m_ptr->ml ? "モンスター" : "何か");
2310 msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
2313 else if (!player_bold(attacker_ptr, ty, tx))
2315 GAME_TEXT m_name[MAX_NLEN];
2316 monster_desc(attacker_ptr, m_name, m_ptr, 0);
2317 msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
2320 if (!player_bold(attacker_ptr, ty, tx)) teleport_player_to(attacker_ptr, ty, tx, TELEPORT_NONMAGICAL);
2322 tmp_mdeath = do_cmd_attack(attacker_ptr, ny, nx, HISSATSU_NYUSIN);
2327 if (!moved && !player_bold(attacker_ptr, ty, tx)) teleport_player_to(attacker_ptr, ty, tx, TELEPORT_NONMAGICAL);
2329 if (mdeath) *mdeath = tmp_mdeath;
2335 * @brief 全鏡の消去 / Remove all mirrors in this floor
2336 * @param caster_ptr プレーヤーへの参照ポインタ
2337 * @param explode 爆発処理を伴うならばTRUE
2340 void remove_all_mirrors(player_type *caster_ptr, bool explode)
2342 for (POSITION x = 0; x < caster_ptr->current_floor_ptr->width; x++)
2344 for (POSITION y = 0; y < caster_ptr->current_floor_ptr->height; y++)
2346 if (!is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[y][x]))
2349 remove_mirror(caster_ptr, y, x);
2350 if (!explode) continue;
2352 project(caster_ptr, 0, 2, y, x, caster_ptr->lev / 2 + 5, GF_SHARDS,
2353 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
2360 * @brief 『一つの指輪』の効果処理 /
2361 * Hack -- activate the ring of power
2362 * @param caster_ptr プレーヤーへの参照ポインタ
2363 * @param dir 発動の方向ID
2366 void ring_of_power(player_type *caster_ptr, DIRECTION dir)
2368 switch (randint1(10))
2373 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
2376 /* Decrease all stats (permanently) */
2377 (void)dec_stat(caster_ptr, A_STR, 50, TRUE);
2378 (void)dec_stat(caster_ptr, A_INT, 50, TRUE);
2379 (void)dec_stat(caster_ptr, A_WIS, 50, TRUE);
2380 (void)dec_stat(caster_ptr, A_DEX, 50, TRUE);
2381 (void)dec_stat(caster_ptr, A_CON, 50, TRUE);
2382 (void)dec_stat(caster_ptr, A_CHR, 50, TRUE);
2384 /* Lose some experience (permanently) */
2385 caster_ptr->exp -= (caster_ptr->exp / 4);
2386 caster_ptr->max_exp -= (caster_ptr->exp / 4);
2387 check_experience(caster_ptr);
2394 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
2395 dispel_monsters(caster_ptr, 1000);
2403 fire_ball(caster_ptr, GF_MANA, dir, 600, 3);
2412 fire_bolt(caster_ptr, GF_MANA, dir, 500);
2420 * @brief 運命の輪、並びにカオス的な効果の発動
2421 * @param caster_ptr プレーヤーへの参照ポインタ
2422 * @param spell ランダムな効果を選択するための基準ID
2425 void wild_magic(player_type *caster_ptr, int spell)
2427 int type = SUMMON_MOLD + randint0(6);
2428 if (type < SUMMON_MOLD) type = SUMMON_MOLD;
2429 else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
2431 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
2432 switch (randint1(spell) + randint1(8) + 1)
2437 teleport_player(caster_ptr, 10, TELEPORT_PASSIVE);
2442 teleport_player(caster_ptr, 100, TELEPORT_PASSIVE);
2446 teleport_player(caster_ptr, 200, TELEPORT_PASSIVE);
2451 unlite_area(caster_ptr, 10, 3);
2456 lite_area(caster_ptr, damroll(2, 3), 2);
2459 destroy_doors_touch(caster_ptr);
2462 wall_breaker(caster_ptr);
2465 sleep_monsters_touch(caster_ptr);
2469 trap_creation(caster_ptr, caster_ptr->y, caster_ptr->x);
2473 door_creation(caster_ptr, caster_ptr->y, caster_ptr->x);
2478 aggravate_monsters(caster_ptr, 0);
2481 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 5, 0);
2485 (void)gain_mutation(caster_ptr, 0);
2489 apply_disenchant(caster_ptr, 1);
2492 lose_all_info(caster_ptr);
2495 fire_ball(caster_ptr, GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
2498 wall_stone(caster_ptr);
2502 for (int counter = 0; counter < 8; counter++)
2504 (void)summon_specific(caster_ptr, 0, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
2510 activate_hi_summon(caster_ptr, caster_ptr->y, caster_ptr->x, FALSE);
2513 (void)summon_cyber(caster_ptr, -1, caster_ptr->y, caster_ptr->x);
2518 (void)activate_ty_curse(caster_ptr, FALSE, &count);
2526 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
2527 * / Drop 10+1d10 meteor ball at random places near the player
2528 * @param caster_ptr プレーヤーへの参照ポインタ
2533 void cast_meteor(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
2535 int b = 10 + randint1(10);
2536 for (int i = 0; i < b; i++)
2538 POSITION y = 0, x = 0;
2541 for (count = 0; count <= 20; count++)
2545 x = caster_ptr->x - 8 + randint0(17);
2546 y = caster_ptr->y - 8 + randint0(17);
2547 dx = (caster_ptr->x > x) ? (caster_ptr->x - x) : (x - caster_ptr->x);
2548 dy = (caster_ptr->y > y) ? (caster_ptr->y - y) : (y - caster_ptr->y);
2549 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
2551 if (d >= 9) continue;
2553 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
2554 if (!in_bounds(floor_ptr, y, x) || !projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)
2555 || !cave_have_flag_bold(floor_ptr, y, x, FF_PROJECT)) continue;
2560 if (count > 20) continue;
2562 project(caster_ptr, 0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
2568 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
2569 * @param caster_ptr プレーヤーへの参照ポインタ
2572 * @return ターゲットを指定し、実行したならばTRUEを返す。
2574 bool cast_wrath_of_the_god(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
2577 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
2579 POSITION tx = caster_ptr->x + 99 * ddx[dir];
2580 POSITION ty = caster_ptr->y + 99 * ddy[dir];
2581 if ((dir == 5) && target_okay(caster_ptr))
2587 POSITION x = caster_ptr->x;
2588 POSITION y = caster_ptr->y;
2592 if ((y == ty) && (x == tx)) break;
2596 mmove2(&ny, &nx, caster_ptr->y, caster_ptr->x, ty, tx);
2597 if (MAX_RANGE <= distance(caster_ptr->y, caster_ptr->x, ny, nx)) break;
2598 if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, ny, nx, FF_PROJECT)) break;
2599 if ((dir != 5) && caster_ptr->current_floor_ptr->grid_array[ny][nx].m_idx != 0) break;
2608 int b = 10 + randint1(10);
2609 for (int i = 0; i < b; i++)
2611 int count = 20, d = 0;
2617 x = tx - 5 + randint0(11);
2618 y = ty - 5 + randint0(11);
2620 dx = (tx > x) ? (tx - x) : (x - tx);
2621 dy = (ty > y) ? (ty - y) : (y - ty);
2623 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
2627 if (count < 0) continue;
2629 if (!in_bounds(caster_ptr->current_floor_ptr, y, x) ||
2630 cave_stop_disintegration(caster_ptr->current_floor_ptr, y, x) ||
2631 !in_disintegration_range(caster_ptr->current_floor_ptr, ty, tx, y, x))
2634 project(caster_ptr, 0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
2642 * @brief 「ワンダー」のランダムな効果を決定して処理する。
2643 * @param caster_ptr プレーヤーへの参照ポインタ
2647 * This spell should become more useful (more controlled) as the\n
2648 * player gains experience levels. Thus, add 1/5 of the player's\n
2649 * level to the die roll. This eliminates the worst effects later on,\n
2650 * while keeping the results quite random. It also allows some potent\n
2651 * effects only at high level.
2653 void cast_wonder(player_type *caster_ptr, DIRECTION dir)
2655 PLAYER_LEVEL plev = caster_ptr->lev;
2656 int die = randint1(100) + plev / 5;
2657 int vir = virtue_number(caster_ptr, V_CHANCE);
2660 if (caster_ptr->virtues[vir - 1] > 0)
2662 while (randint1(400) < caster_ptr->virtues[vir - 1]) die++;
2666 while (randint1(400) < (0 - caster_ptr->virtues[vir - 1])) die--;
2672 chg_virtue(caster_ptr, V_CHANCE, 1);
2677 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
2682 clone_monster(caster_ptr, dir);
2688 speed_monster(caster_ptr, dir, plev);
2694 heal_monster(caster_ptr, dir, damroll(4, 6));
2700 poly_monster(caster_ptr, dir, plev);
2706 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_MISSILE, dir,
2707 damroll(3 + ((plev - 1) / 5), 4));
2713 confuse_monster(caster_ptr, dir, plev);
2719 fire_ball(caster_ptr, GF_POIS, dir, 20 + (plev / 2), 3);
2725 (void)lite_line(caster_ptr, dir, damroll(6, 8));
2731 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_ELEC, dir,
2732 damroll(3 + ((plev - 5) / 4), 8));
2738 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_COLD, dir,
2739 damroll(5 + ((plev - 5) / 4), 8));
2745 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_ACID, dir,
2746 damroll(6 + ((plev - 5) / 4), 8));
2752 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_FIRE, dir,
2753 damroll(8 + ((plev - 5) / 4), 8));
2759 hypodynamic_bolt(caster_ptr, dir, 75);
2765 fire_ball(caster_ptr, GF_ELEC, dir, 30 + plev / 2, 2);
2771 fire_ball(caster_ptr, GF_ACID, dir, 40 + plev, 2);
2777 fire_ball(caster_ptr, GF_ICE, dir, 70 + plev, 3);
2783 fire_ball(caster_ptr, GF_FIRE, dir, 80 + plev, 3);
2789 hypodynamic_bolt(caster_ptr, dir, 100 + plev);
2795 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 12, 0);
2801 (void)destroy_area(caster_ptr, caster_ptr->y, caster_ptr->x, 13 + randint0(5), FALSE);
2807 symbol_genocide(caster_ptr, plev + 50, TRUE);
2813 dispel_monsters(caster_ptr, 120);
2817 dispel_monsters(caster_ptr, 150);
2818 slow_monsters(caster_ptr, plev);
2819 sleep_monsters(caster_ptr, plev);
2820 hp_player(caster_ptr, 300);
2825 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
2826 * @param caster_ptr プレーヤーへの参照ポインタ
2830 void cast_invoke_spirits(player_type *caster_ptr, DIRECTION dir)
2832 PLAYER_LEVEL plev = caster_ptr->lev;
2833 int die = randint1(100) + plev / 5;
2834 int vir = virtue_number(caster_ptr, V_CHANCE);
2838 if (caster_ptr->virtues[vir - 1] > 0)
2840 while (randint1(400) < caster_ptr->virtues[vir - 1]) die++;
2844 while (randint1(400) < (0 - caster_ptr->virtues[vir - 1])) die--;
2848 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
2850 chg_virtue(caster_ptr, V_CHANCE, 1);
2854 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
2859 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
2860 "Oh no! Mouldering forms rise from the earth around you!"));
2862 (void)summon_specific(caster_ptr, 0, caster_ptr->y, caster_ptr->x, caster_ptr->current_floor_ptr->dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
2863 chg_virtue(caster_ptr, V_UNLIFE, 1);
2867 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
2869 set_afraid(caster_ptr, caster_ptr->afraid + randint1(4) + 4);
2873 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
2874 "Your head is invaded by a horde of gibbering spectral voices..."));
2876 set_confused(caster_ptr, caster_ptr->confused + randint1(4) + 4);
2880 poly_monster(caster_ptr, dir, plev);
2884 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_MISSILE, dir,
2885 damroll(3 + ((plev - 1) / 5), 4));
2889 confuse_monster(caster_ptr, dir, plev);
2893 fire_ball(caster_ptr, GF_POIS, dir, 20 + (plev / 2), 3);
2897 (void)lite_line(caster_ptr, dir, damroll(6, 8));
2901 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_ELEC, dir,
2902 damroll(3 + ((plev - 5) / 4), 8));
2906 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_COLD, dir,
2907 damroll(5 + ((plev - 5) / 4), 8));
2911 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_ACID, dir,
2912 damroll(6 + ((plev - 5) / 4), 8));
2916 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_FIRE, dir,
2917 damroll(8 + ((plev - 5) / 4), 8));
2921 hypodynamic_bolt(caster_ptr, dir, 75);
2925 fire_ball(caster_ptr, GF_ELEC, dir, 30 + plev / 2, 2);
2929 fire_ball(caster_ptr, GF_ACID, dir, 40 + plev, 2);
2933 fire_ball(caster_ptr, GF_ICE, dir, 70 + plev, 3);
2937 fire_ball(caster_ptr, GF_FIRE, dir, 80 + plev, 3);
2941 hypodynamic_bolt(caster_ptr, dir, 100 + plev);
2945 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 12, 0);
2949 (void)destroy_area(caster_ptr, caster_ptr->y, caster_ptr->x, 13 + randint0(5), FALSE);
2953 symbol_genocide(caster_ptr, plev + 50, TRUE);
2957 dispel_monsters(caster_ptr, 120);
2961 dispel_monsters(caster_ptr, 150);
2962 slow_monsters(caster_ptr, plev);
2963 sleep_monsters(caster_ptr, plev);
2964 hp_player(caster_ptr, 300);
2969 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
2970 "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
2976 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
2977 * @param caster_ptr プレーヤーへの参照ポインタ
2980 void cast_shuffle(player_type *caster_ptr)
2982 PLAYER_LEVEL plev = caster_ptr->lev;
2985 int vir = virtue_number(caster_ptr, V_CHANCE);
2988 if ((caster_ptr->pclass == CLASS_ROGUE) ||
2989 (caster_ptr->pclass == CLASS_HIGH_MAGE) ||
2990 (caster_ptr->pclass == CLASS_SORCERER))
2991 die = (randint1(110)) + plev / 5;
2993 die = randint1(120);
2997 if (caster_ptr->virtues[vir - 1] > 0)
2999 while (randint1(400) < caster_ptr->virtues[vir - 1]) die++;
3003 while (randint1(400) < (0 - caster_ptr->virtues[vir - 1])) die--;
3007 msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
3011 chg_virtue(caster_ptr, V_CHANCE, 1);
3014 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
3017 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
3019 for (i = 0; i < randint1(3); i++)
3021 activate_hi_summon(caster_ptr, caster_ptr->y, caster_ptr->x, FALSE);
3029 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
3030 summon_specific(caster_ptr, 0, caster_ptr->y, caster_ptr->x, floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
3037 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
3038 activate_ty_curse(caster_ptr, FALSE, &count);
3044 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
3045 aggravate_monsters(caster_ptr, 0);
3051 msg_print(_("《愚者》だ。", "It's the Fool."));
3052 do_dec_stat(caster_ptr, A_INT);
3053 do_dec_stat(caster_ptr, A_WIS);
3059 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
3060 trump_summoning(caster_ptr, 1, FALSE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
3066 msg_print(_("《月》だ。", "It's the Moon."));
3067 unlite_area(caster_ptr, 10, 3);
3073 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
3074 wild_magic(caster_ptr, randint0(32));
3080 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
3081 teleport_player(caster_ptr, 10, TELEPORT_PASSIVE);
3087 msg_print(_("《正義》だ。", "It's Justice."));
3088 set_blessed(caster_ptr, caster_ptr->lev, FALSE);
3094 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
3095 teleport_player(caster_ptr, 100, TELEPORT_PASSIVE);
3101 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
3102 teleport_player(caster_ptr, 200, TELEPORT_PASSIVE);
3108 msg_print(_("《塔》だ。", "It's the Tower."));
3109 wall_breaker(caster_ptr);
3115 msg_print(_("《節制》だ。", "It's Temperance."));
3116 sleep_monsters_touch(caster_ptr);
3122 msg_print(_("《塔》だ。", "It's the Tower."));
3123 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 5, 0);
3129 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
3130 trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_MOLD, 0L);
3136 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
3137 trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_BAT, 0L);
3143 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
3144 trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_VORTEX, 0L);
3150 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
3151 trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
3157 msg_print(_("《恋人》だ。", "It's the Lovers."));
3159 if (get_aim_dir(caster_ptr, &dir))
3161 charm_monster(caster_ptr, dir, MIN(caster_ptr->lev, 20));
3169 msg_print(_("《隠者》だ。", "It's the Hermit."));
3170 wall_stone(caster_ptr);
3176 msg_print(_("《審判》だ。", "It's the Judgement."));
3177 roll_hitdice(caster_ptr, 0L);
3178 lose_all_mutations(caster_ptr);
3184 msg_print(_("《太陽》だ。", "It's the Sun."));
3185 chg_virtue(caster_ptr, V_KNOWLEDGE, 1);
3186 chg_virtue(caster_ptr, V_ENLIGHTEN, 1);
3187 wiz_lite(caster_ptr, FALSE);
3191 msg_print(_("《世界》だ。", "It's the World."));
3192 if (caster_ptr->exp >= PY_MAX_EXP)
3197 s32b ee = (caster_ptr->exp / 25) + 1;
3198 if (ee > 5000) ee = 5000;
3199 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
3200 gain_exp(caster_ptr, ee);
3204 bool vampirism(player_type *caster_ptr)
3206 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
3208 msg_print(_("なぜか攻撃することができない。", "Something prevents you from attacking."));
3213 if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return FALSE;
3215 POSITION y = caster_ptr->y + ddy[dir];
3216 POSITION x = caster_ptr->x + ddx[dir];
3218 g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
3219 stop_mouth(caster_ptr);
3220 if (!(g_ptr->m_idx))
3222 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
3226 msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
3228 int dummy = caster_ptr->lev * 2;
3229 if (!hypodynamic_bolt(caster_ptr, dir, dummy))
3231 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
3235 if (caster_ptr->food < PY_FOOD_FULL)
3236 (void)hp_player(caster_ptr, dummy);
3238 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
3240 /* Gain nutritional sustenance: 150/hp drained */
3241 /* A Food ration gives 5000 food points (by contrast) */
3242 /* Don't ever get more than "Full" this way */
3243 /* But if we ARE Gorged, it won't cure us */
3244 dummy = caster_ptr->food + MIN(5000, 100 * dummy);
3245 if (caster_ptr->food < PY_FOOD_MAX) /* Not gorged already */
3246 (void)set_food(caster_ptr, dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
3252 * ヒット&アウェイのレイシャルパワー/突然変異
3253 * @param caster_ptr プレーヤーへの参照ポインタ
3254 * @return コマンドの入力先にモンスターがいたらTRUE
3256 bool hit_and_away(player_type *caster_ptr)
3259 if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return FALSE;
3260 POSITION y = caster_ptr->y + ddy[dir];
3261 POSITION x = caster_ptr->x + ddx[dir];
3262 if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
3264 do_cmd_attack(caster_ptr, y, x, 0);
3265 if (randint0(caster_ptr->skill_dis) < 7)
3266 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
3268 teleport_player(caster_ptr, 30, TELEPORT_SPONTANEOUS);
3272 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
3279 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
3280 * @param caster_ptr プレーヤーへの参照ポインタ
3283 * currently this function allows pseudo-id of any object,
3284 * including silly ones like potions & scrolls, which always
3285 * get '{average}'. This should be changed, either to stop such
3286 * items from being pseudo-id'd, or to allow psychometry to
3287 * detect whether the unidentified potion/scroll/etc is
3288 * good (Cure Light Wounds, Restore Strength, etc) or
3289 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
3291 bool psychometry(player_type *caster_ptr)
3293 concptr q = _("どのアイテムを調べますか?", "Meditate on which item? ");
3294 concptr s = _("調べるアイテムがありません。", "You have nothing appropriate.");
3297 o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
3298 if (!o_ptr) return FALSE;
3300 if (object_is_known(o_ptr))
3302 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
3306 item_feel_type feel = pseudo_value_check_heavy(o_ptr);
3307 GAME_TEXT o_name[MAX_NLEN];
3308 object_desc(caster_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
3312 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
3317 msg_format("%sは%sという感じがする...", o_name, game_inscriptions[feel]);
3319 msg_format("You feel that the %s %s %s...",
3320 o_name, ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
3323 o_ptr->ident |= (IDENT_SENSE);
3324 o_ptr->feeling = feel;
3325 o_ptr->marked |= OM_TOUCHED;
3327 caster_ptr->update |= (PU_COMBINE | PU_REORDER);
3328 caster_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
3331 switch (o_ptr->tval)
3359 autopick_alter_item(caster_ptr, item, (bool)(okay && destroy_feeling));
3364 bool draconian_breath(player_type *creature_ptr)
3366 int Type = (one_in_(3) ? GF_COLD : GF_FIRE);
3367 concptr Type_desc = ((Type == GF_COLD) ? _("冷気", "cold") : _("炎", "fire"));
3369 if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
3371 if (randint1(100) < creature_ptr->lev)
3373 switch (creature_ptr->pclass)
3376 case CLASS_BERSERKER:
3379 case CLASS_IMITATOR:
3385 Type_desc = _("エレメント", "the elements");
3390 Type_desc = _("破片", "shards");
3395 case CLASS_WARRIOR_MAGE:
3396 case CLASS_HIGH_MAGE:
3397 case CLASS_SORCERER:
3398 case CLASS_MAGIC_EATER:
3399 case CLASS_RED_MAGE:
3400 case CLASS_BLUE_MAGE:
3401 case CLASS_MIRROR_MASTER:
3405 Type_desc = _("魔力", "mana");
3409 Type = GF_DISENCHANT;
3410 Type_desc = _("劣化", "disenchantment");
3414 case CLASS_CHAOS_WARRIOR:
3417 Type = GF_CONFUSION;
3418 Type_desc = _("混乱", "confusion");
3423 Type_desc = _("カオス", "chaos");
3429 case CLASS_FORCETRAINER:
3432 Type = GF_CONFUSION;
3433 Type_desc = _("混乱", "confusion");
3438 Type_desc = _("轟音", "sound");
3442 case CLASS_MINDCRAFTER:
3445 Type = GF_CONFUSION;
3446 Type_desc = _("混乱", "confusion");
3451 Type_desc = _("精神エネルギー", "mental energy");
3459 Type = GF_HELL_FIRE;
3460 Type_desc = _("地獄の劫火", "hellfire");
3464 Type = GF_HOLY_FIRE;
3465 Type_desc = _("聖なる炎", "holy fire");
3474 Type_desc = _("暗黒", "darkness");
3479 Type_desc = _("毒", "poison");
3487 Type_desc = _("轟音", "sound");
3491 Type = GF_CONFUSION;
3492 Type_desc = _("混乱", "confusion");
3499 stop_mouth(creature_ptr);
3500 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), Type_desc);
3502 fire_breath(creature_ptr, Type, dir, creature_ptr->lev * 2, (creature_ptr->lev / 15) + 1);
3507 bool android_inside_weapon(player_type *creature_ptr)
3510 if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
3512 if (creature_ptr->lev < 10)
3514 msg_print(_("レイガンを発射した。", "You fire your ray gun."));
3515 fire_bolt(creature_ptr, GF_MISSILE, dir, (creature_ptr->lev + 1) / 2);
3519 if (creature_ptr->lev < 25)
3521 msg_print(_("ブラスターを発射した。", "You fire your blaster."));
3522 fire_bolt(creature_ptr, GF_MISSILE, dir, creature_ptr->lev);
3526 if (creature_ptr->lev < 35)
3528 msg_print(_("バズーカを発射した。", "You fire your bazooka."));
3529 fire_ball(creature_ptr, GF_MISSILE, dir, creature_ptr->lev * 2, 2);
3533 if (creature_ptr->lev < 45)
3535 msg_print(_("ビームキャノンを発射した。", "You fire a beam cannon."));
3536 fire_beam(creature_ptr, GF_MISSILE, dir, creature_ptr->lev * 2);
3540 msg_print(_("ロケットを発射した。", "You fire a rocket."));
3541 fire_rocket(creature_ptr, GF_ROCKET, dir, creature_ptr->lev * 5, 2);
3546 bool create_ration(player_type *creature_ptr)
3552 /* Create the food ration */
3553 object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION));
3555 /* Drop the object from heaven */
3556 (void)drop_near(creature_ptr, q_ptr, -1, creature_ptr->y, creature_ptr->x);
3557 msg_print(_("食事を料理して作った。", "You cook some food."));
3562 void hayagake(player_type *creature_ptr)
3564 if (creature_ptr->action == ACTION_HAYAGAKE)
3566 set_action(creature_ptr, ACTION_NONE);
3567 creature_ptr->energy_use = 0;
3571 grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
3572 feature_type *f_ptr = &f_info[g_ptr->feat];
3574 if (!have_flag(f_ptr->flags, FF_PROJECT) ||
3575 (!creature_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP)))
3577 msg_print(_("ここでは素早く動けない。", "You cannot run in here."));
3581 set_action(creature_ptr, ACTION_HAYAGAKE);
3584 creature_ptr->energy_use = 0;
3588 bool double_attack(player_type *creature_ptr)
3591 if (!get_rep_dir(creature_ptr, &dir, FALSE)) return FALSE;
3592 POSITION y = creature_ptr->y + ddy[dir];
3593 POSITION x = creature_ptr->x + ddx[dir];
3594 if (!creature_ptr->current_floor_ptr->grid_array[y][x].m_idx)
3596 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
3602 msg_print(_("あーたたたたたたたたたたたたたたたたたたたたたた!!!",
3603 "Ahhhtatatatatatatatatatatatatatataatatatatattaaaaa!!!!"));
3604 else if (one_in_(2))
3605 msg_print(_("無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄!!!",
3606 "Mudamudamudamudamudamudamudamudamudamudamudamudamuda!!!!"));
3608 msg_print(_("オラオラオラオラオラオラオラオラオラオラオラオラ!!!",
3609 "Oraoraoraoraoraoraoraoraoraoraoraoraoraoraoraoraora!!!!"));
3611 do_cmd_attack(creature_ptr, y, x, 0);
3612 if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx)
3614 handle_stuff(creature_ptr);
3615 do_cmd_attack(creature_ptr, y, x, 0);
3618 creature_ptr->energy_need += ENERGY_NEED();
3623 bool comvert_hp_to_mp(player_type *creature_ptr)
3625 int gain_sp = take_hit(creature_ptr, DAMAGE_USELIFE, creature_ptr->lev, _("HPからMPへの無謀な変換", "thoughtless conversion from HP to SP"), -1) / 5;
3628 msg_print(_("変換に失敗した。", "You failed to convert."));
3629 creature_ptr->redraw |= (PR_HP | PR_MANA);
3633 creature_ptr->csp += gain_sp;
3634 if (creature_ptr->csp > creature_ptr->msp)
3636 creature_ptr->csp = creature_ptr->msp;
3637 creature_ptr->csp_frac = 0;
3640 creature_ptr->redraw |= (PR_HP | PR_MANA);
3645 bool comvert_mp_to_hp(player_type *creature_ptr)
3647 if (creature_ptr->csp >= creature_ptr->lev / 5)
3649 creature_ptr->csp -= creature_ptr->lev / 5;
3650 hp_player(creature_ptr, creature_ptr->lev);
3654 msg_print(_("変換に失敗した。", "You failed to convert."));
3657 creature_ptr->redraw |= (PR_HP | PR_MANA);
3662 bool demonic_breath(player_type *creature_ptr)
3665 int type = (one_in_(2) ? GF_NETHER : GF_FIRE);
3666 if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
3667 stop_mouth(creature_ptr);
3668 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), ((type == GF_NETHER) ? _("地獄", "nether") : _("火炎", "fire")));
3669 fire_breath(creature_ptr, type, dir, creature_ptr->lev * 3, (creature_ptr->lev / 15) + 1);
3676 * @param creature_ptr プレーヤーへの参照ポインタ
3679 bool sword_dancing(player_type *creature_ptr)
3682 POSITION y = 0, x = 0;
3684 for (int i = 0; i < 6; i++)
3687 y = creature_ptr->y + ddy_ddd[dir];
3688 x = creature_ptr->x + ddx_ddd[dir];
3689 g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
3691 /* Hack -- attack monsters */
3693 do_cmd_attack(creature_ptr, y, x, 0);
3696 msg_print(_("攻撃が空をきった。", "You attack the empty air."));
3706 * @param creature_ptr プレーヤーへの参照ポインタ
3709 bool confusing_light(player_type *creature_ptr)
3711 msg_print(_("辺りを睨んだ...", "You glare nearby monsters..."));
3712 slow_monsters(creature_ptr, creature_ptr->lev);
3713 stun_monsters(creature_ptr, creature_ptr->lev * 4);
3714 confuse_monsters(creature_ptr, creature_ptr->lev * 4);
3715 turn_monsters(creature_ptr, creature_ptr->lev * 4);
3716 stasis_monsters(creature_ptr, creature_ptr->lev * 4);
3721 bool clear_mind(player_type *creature_ptr)
3725 msg_print(_("今はペットを操ることに集中していないと。", "Your pets demand all of your attention."));
3729 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
3731 creature_ptr->csp += (3 + creature_ptr->lev / 20);
3732 if (creature_ptr->csp >= creature_ptr->msp)
3734 creature_ptr->csp = creature_ptr->msp;
3735 creature_ptr->csp_frac = 0;
3738 creature_ptr->redraw |= (PR_MANA);