3 * @brief 魔法効果の実装/ Spell code (part 3)
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.
15 #include "object-hook.h"
17 /*! テレポート先探索の試行数 / Maximum number of tries for teleporting */
22 * @brief モンスターのテレポートアウェイ処理 /
23 * Teleport a monster, normally up to "dis" grids away.
24 * @param m_idx モンスターID
27 * @return テレポートが実際に行われたらtrue
29 * Attempt to move the monster at least "dis/2" grids away.
30 * But allow variation to prevent infinite loops.
32 bool teleport_away(MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode)
34 POSITION oy, ox, d, i, min;
36 POSITION ny = 0, nx = 0;
40 monster_type *m_ptr = &m_list[m_idx];
43 if (!m_ptr->r_idx) return (FALSE);
45 /* Save the old location */
49 /* Minimum distance */
52 if ((mode & TELEPORT_DEC_VALOUR) &&
53 (((p_ptr->chp * 10) / p_ptr->mhp) > 5) &&
54 (4+randint1(5) < ((p_ptr->chp * 10) / p_ptr->mhp)))
56 chg_virtue(V_VALOUR, -1);
64 /* Verify max distance */
65 if (dis > 200) dis = 200;
67 /* Try several locations */
68 for (i = 0; i < 500; i++)
70 /* Pick a (possibly illegal) location */
73 ny = rand_spread(oy, dis);
74 nx = rand_spread(ox, dis);
75 d = distance(oy, ox, ny, nx);
76 if ((d >= min) && (d <= dis)) break;
79 /* Ignore illegal locations */
80 if (!in_bounds(ny, nx)) continue;
82 if (!cave_monster_teleportable_bold(m_idx, ny, nx, mode)) continue;
84 /* No teleporting into vaults and such */
85 if (!(p_ptr->inside_quest || p_ptr->inside_arena))
86 if (cave[ny][nx].info & CAVE_ICKY) continue;
88 /* This grid looks good */
95 /* Increase the maximum distance */
98 /* Decrease the minimum distance */
101 /* Stop after MAX_TRIES tries */
102 if (tries > MAX_TRIES) return (FALSE);
106 sound(SOUND_TPOTHER);
108 /* Update the old location */
109 cave[oy][ox].m_idx = 0;
111 /* Update the new location */
112 cave[ny][nx].m_idx = m_idx;
114 /* Move the monster */
118 /* Forget the counter target */
121 /* Update the monster (new location) */
122 update_mon(m_idx, TRUE);
124 /* Redraw the old grid */
127 /* Redraw the new grid */
130 if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
131 p_ptr->update |= (PU_MON_LITE);
138 * @brief モンスターを指定された座標付近にテレポートする /
139 * Teleport monster next to a grid near the given location
140 * @param m_idx モンスターID
143 * @param power テレポート成功確率
147 void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, BIT_FLAGS mode)
149 int ny, nx, oy, ox, d, i, min;
153 monster_type *m_ptr = &m_list[m_idx];
156 if (!m_ptr->r_idx) return;
159 if (randint1(100) > power) return;
165 /* Save the old location */
169 /* Minimum distance */
172 /* Look until done */
173 while (look && --attempts)
175 /* Verify max distance */
176 if (dis > 200) dis = 200;
178 /* Try several locations */
179 for (i = 0; i < 500; i++)
181 /* Pick a (possibly illegal) location */
184 ny = rand_spread(ty, dis);
185 nx = rand_spread(tx, dis);
186 d = distance(ty, tx, ny, nx);
187 if ((d >= min) && (d <= dis)) break;
190 /* Ignore illegal locations */
191 if (!in_bounds(ny, nx)) continue;
193 if (!cave_monster_teleportable_bold(m_idx, ny, nx, mode)) continue;
195 /* No teleporting into vaults and such */
196 /* if (cave[ny][nx].info & (CAVE_ICKY)) continue; */
198 /* This grid looks good */
205 /* Increase the maximum distance */
208 /* Decrease the minimum distance */
212 if (attempts < 1) return;
215 sound(SOUND_TPOTHER);
217 /* Update the old location */
218 cave[oy][ox].m_idx = 0;
220 /* Update the new location */
221 cave[ny][nx].m_idx = m_idx;
223 /* Move the monster */
227 /* Update the monster (new location) */
228 update_mon(m_idx, TRUE);
230 /* Redraw the old grid */
233 /* Redraw the new grid */
236 if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
237 p_ptr->update |= (PU_MON_LITE);
241 * @brief プレイヤーのテレポート先選定と移動処理 /
242 * Teleport the player to a location up to "dis" grids away.
245 * @return 実際にテレポート処理が行われたらtrue
248 * If no such spaces are readily available, the distance may increase.
249 * Try very hard to move the player at least a quarter that distance.
251 * There was a nasty tendency for a long time; which was causing the
252 * player to "bounce" between two or three different spots because
253 * these are the only spots that are "far enough" way to satisfy the
256 * But this tendency is now removed; in the new algorithm, a list of
257 * candidates is selected first, which includes at least 50% of all
258 * floor grids within the distance, and any single grid in this list
259 * of candidates has equal possibility to be choosen as a destination.
263 bool teleport_player_aux(int dis, BIT_FLAGS mode)
265 int candidates_at[MAX_TELEPORT_DISTANCE + 1];
266 int total_candidates, cur_candidates;
267 POSITION y = 0, x = 0;
270 int left = MAX(1, p_ptr->x - dis);
271 int right = MIN(cur_wid - 2, p_ptr->x + dis);
272 int top = MAX(1, p_ptr->y - dis);
273 int bottom = MIN(cur_hgt - 2, p_ptr->y + dis);
275 if (p_ptr->wild_mode) return FALSE;
277 if (p_ptr->anti_tele && !(mode & TELEPORT_NONMAGICAL))
279 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
283 /* Initialize counters */
284 total_candidates = 0;
285 for (i = 0; i <= MAX_TELEPORT_DISTANCE; i++)
286 candidates_at[i] = 0;
288 /* Limit the distance */
289 if (dis > MAX_TELEPORT_DISTANCE) dis = MAX_TELEPORT_DISTANCE;
291 /* Search valid locations */
292 for (y = top; y <= bottom; y++)
294 for (x = left; x <= right; x++)
298 /* Skip illegal locations */
299 if (!cave_player_teleportable_bold(y, x, mode)) continue;
301 /* Calculate distance */
302 d = distance(p_ptr->y, p_ptr->x, y, x);
304 /* Skip too far locations */
305 if (d > dis) continue;
307 /* Count the total number of candidates */
310 /* Count the number of candidates in this circumference */
315 /* No valid location! */
316 if (0 == total_candidates) return FALSE;
318 /* Fix the minimum distance */
319 for (cur_candidates = 0, min = dis; min >= 0; min--)
321 cur_candidates += candidates_at[min];
323 /* 50% of all candidates will have an equal chance to be choosen. */
324 if (cur_candidates && (cur_candidates >= total_candidates / 2)) break;
327 /* Pick up a single location randomly */
328 pick = randint1(cur_candidates);
330 /* Search again the choosen location */
331 for (y = top; y <= bottom; y++)
333 for (x = left; x <= right; x++)
337 /* Skip illegal locations */
338 if (!cave_player_teleportable_bold(y, x, mode)) continue;
340 /* Calculate distance */
341 d = distance(p_ptr->y, p_ptr->x, y, x);
343 /* Skip too far locations */
344 if (d > dis) continue;
346 /* Skip too close locations */
347 if (d < min) continue;
349 /* This grid was picked up? */
358 if (player_bold(y, x)) return FALSE;
361 sound(SOUND_TELEPORT);
364 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
365 msg_format("『こっちだぁ、%s』", p_ptr->name);
368 /* Move the player */
369 (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
375 * @brief プレイヤーのテレポート処理メインルーチン
380 void teleport_player(int dis, BIT_FLAGS mode)
384 /* Save the old location */
388 if (!teleport_player_aux(dis, mode)) return;
390 /* Monsters with teleport ability may follow the player */
391 for (xx = -1; xx < 2; xx++)
393 for (yy = -1; yy < 2; yy++)
395 MONSTER_IDX tmp_m_idx = cave[oy+yy][ox+xx].m_idx;
397 /* A monster except your mount may follow */
398 if (tmp_m_idx && (p_ptr->riding != tmp_m_idx))
400 monster_type *m_ptr = &m_list[tmp_m_idx];
401 monster_race *r_ptr = &r_info[m_ptr->r_idx];
404 * The latter limitation is to avoid
405 * totally unkillable suckers...
407 if ((r_ptr->a_ability_flags2 & RF6_TPORT) &&
408 !(r_ptr->flagsr & RFR_RES_TELE))
410 if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, p_ptr->y, p_ptr->x, r_ptr->level, 0L);
419 * @brief プレイヤーのテレポートアウェイ処理 /
420 * @param m_idx アウェイを試みたプレイヤーID
424 void teleport_player_away(MONSTER_IDX m_idx, int dis)
428 /* Save the old location */
432 if (!teleport_player_aux(dis, TELEPORT_PASSIVE)) return;
434 /* Monsters with teleport ability may follow the player */
435 for (xx = -1; xx < 2; xx++)
437 for (yy = -1; yy < 2; yy++)
439 IDX tmp_m_idx = cave[oy+yy][ox+xx].m_idx;
441 /* A monster except your mount or caster may follow */
442 if (tmp_m_idx && (p_ptr->riding != tmp_m_idx) && (m_idx != tmp_m_idx))
444 monster_type *m_ptr = &m_list[tmp_m_idx];
445 monster_race *r_ptr = &r_info[m_ptr->r_idx];
448 * The latter limitation is to avoid
449 * totally unkillable suckers...
451 if ((r_ptr->a_ability_flags2 & RF6_TPORT) &&
452 !(r_ptr->flagsr & RFR_RES_TELE))
454 if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, p_ptr->y, p_ptr->x, r_ptr->level, 0L);
463 * @brief プレイヤーを指定位置近辺にテレポートさせる
464 * Teleport player to a grid near the given location
467 * @param mode オプションフラグ
471 * This function is slightly obsessive about correctness.
472 * This function allows teleporting into vaults (!)
475 void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode)
478 int dis = 0, ctr = 0;
480 if (p_ptr->anti_tele && !(mode & TELEPORT_NONMAGICAL))
482 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
486 /* Find a usable location */
489 /* Pick a nearby legal location */
492 y = (POSITION)rand_spread(ny, dis);
493 x = (POSITION)rand_spread(nx, dis);
494 if (in_bounds(y, x)) break;
497 /* Accept any grid when wizard mode */
498 if (p_ptr->wizard && !(mode & TELEPORT_PASSIVE) && (!cave[y][x].m_idx || (cave[y][x].m_idx == p_ptr->riding))) break;
500 /* Accept teleportable floor grids */
501 if (cave_player_teleportable_bold(y, x, mode)) break;
503 /* Occasionally advance the distance */
504 if (++ctr > (4 * dis * dis + 4 * dis + 1))
512 sound(SOUND_TELEPORT);
514 /* Move the player */
515 (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
519 void teleport_away_followable(MONSTER_IDX m_idx)
521 monster_type *m_ptr = &m_list[m_idx];
522 int oldfy = m_ptr->fy;
523 int oldfx = m_ptr->fx;
524 bool old_ml = m_ptr->ml;
525 int old_cdis = m_ptr->cdis;
527 teleport_away(m_idx, MAX_SIGHT * 2 + 5, 0L);
529 if (old_ml && (old_cdis <= MAX_SIGHT) && !world_monster && !p_ptr->inside_battle && los(p_ptr->y, p_ptr->x, oldfy, oldfx))
533 if ((p_ptr->muta1 & MUT1_VTELEPORT) || (p_ptr->pclass == CLASS_IMITATOR)) follow = TRUE;
536 u32b flgs[TR_FLAG_SIZE];
540 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
542 o_ptr = &inventory[i];
543 if (o_ptr->k_idx && !object_is_cursed(o_ptr))
545 object_flags(o_ptr, flgs);
546 if (have_flag(flgs, TR_TELEPORT))
557 if (get_check_strict(_("ついていきますか?", "Do you follow it? "), CHECK_OKAY_CANCEL))
561 teleport_player(200, TELEPORT_PASSIVE);
562 msg_print(_("失敗!", "Failed!"));
564 else teleport_player_to(m_ptr->fy, m_ptr->fx, 0L);
565 p_ptr->energy_need += ENERGY_NEED();
573 * @brief プレイヤー及びモンスターをレベルテレポートさせる /
574 * Teleport the player one level up or down (random when legal)
575 * @param m_idx テレポートの対象となるモンスターID(0ならばプレイヤー) / If m_idx <= 0, target is player.
578 void teleport_level(MONSTER_IDX m_idx)
584 if (m_idx <= 0) /* To player */
586 strcpy(m_name, _("あなた", "you"));
588 else /* To monster */
590 monster_type *m_ptr = &m_list[m_idx];
592 /* Get the monster name (or "it") */
593 monster_desc(m_name, m_ptr, 0);
595 see_m = is_seen(m_ptr);
598 /* No effect in some case */
599 if (TELE_LEVEL_IS_INEFF(m_idx))
601 if (see_m) msg_print(_("効果がなかった。", "There is no effect."));
605 if ((m_idx <= 0) && p_ptr->anti_tele) /* To player */
607 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
611 /* Choose up or down */
612 if (randint0(100) < 50) go_up = TRUE;
615 if ((m_idx <= 0) && p_ptr->wizard)
617 if (get_check("Force to go up? ")) go_up = TRUE;
618 else if (get_check("Force to go down? ")) go_up = FALSE;
622 if ((ironman_downward && (m_idx <= 0)) || (dun_level <= d_info[dungeon_type].mindepth))
625 if (see_m) msg_format("%^sは床を突き破って沈んでいく。", m_name);
627 if (see_m) msg_format("%^s sink%s through the floor.", m_name, (m_idx <= 0) ? "" : "s");
629 if (m_idx <= 0) /* To player */
633 dungeon_type = ironman_downward ? DUNGEON_ANGBAND : p_ptr->recall_dungeon;
634 p_ptr->oldpy = p_ptr->y;
635 p_ptr->oldpx = p_ptr->x;
638 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL);
640 if (autosave_l) do_cmd_save_game(TRUE);
644 dun_level = d_info[dungeon_type].mindepth;
645 prepare_change_floor_mode(CFM_RAND_PLACE);
649 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
653 p_ptr->leaving = TRUE;
658 else if (quest_number(dun_level) || (dun_level >= d_info[dungeon_type].maxdepth))
661 if (see_m) msg_format("%^sは天井を突き破って宙へ浮いていく。", m_name);
663 if (see_m) msg_format("%^s rise%s up through the ceiling.", m_name, (m_idx <= 0) ? "" : "s");
667 if (m_idx <= 0) /* To player */
669 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, -1, NULL);
671 if (autosave_l) do_cmd_save_game(TRUE);
673 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP | CFM_RAND_PLACE | CFM_RAND_CONNECT);
678 p_ptr->inside_quest = 0;
679 p_ptr->leaving = TRUE;
685 if (see_m) msg_format("%^sは天井を突き破って宙へ浮いていく。", m_name);
687 if (see_m) msg_format("%^s rise%s up through the ceiling.", m_name, (m_idx <= 0) ? "" : "s");
691 if (m_idx <= 0) /* To player */
693 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, -1, NULL);
695 if (autosave_l) do_cmd_save_game(TRUE);
697 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP | CFM_RAND_PLACE | CFM_RAND_CONNECT);
700 p_ptr->leaving = TRUE;
706 if (see_m) msg_format("%^sは床を突き破って沈んでいく。", m_name);
708 if (see_m) msg_format("%^s sink%s through the floor.", m_name, (m_idx <= 0) ? "" : "s");
711 if (m_idx <= 0) /* To player */
713 /* Never reach this code on the surface */
714 /* if (!dun_level) dungeon_type = p_ptr->recall_dungeon; */
716 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL);
718 if (autosave_l) do_cmd_save_game(TRUE);
720 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
723 p_ptr->leaving = TRUE;
727 /* Monster level teleportation is simple deleting now */
730 monster_type *m_ptr = &m_list[m_idx];
732 /* Check for quest completion */
733 check_quest_completion(m_ptr);
735 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
739 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
740 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_TELE_LEVEL, m2_name);
743 delete_monster_idx(m_idx);
747 sound(SOUND_TPLEVEL);
752 * @brief これまでに入ったダンジョンの一覧を表示し、選択させる。
753 * @param note ダンジョンに施す処理記述
756 * @return 選択されたダンジョンID
758 DUNGEON_IDX choose_dungeon(cptr note, POSITION y, POSITION x)
760 DUNGEON_IDX select_dungeon;
765 /* Hack -- No need to choose dungeon in some case */
766 if (lite_town || vanilla_town || ironman_downward)
768 if (max_dlv[DUNGEON_ANGBAND]) return DUNGEON_ANGBAND;
771 msg_format(_("まだ%sに入ったことはない。", "You haven't entered %s yet."), d_name + d_info[DUNGEON_ANGBAND].name);
777 /* Allocate the "dun" array */
778 C_MAKE(dun, max_d_idx, s16b);
781 for(i = 1; i < max_d_idx; i++)
786 if (!d_info[i].maxdepth) continue;
787 if (!max_dlv[i]) continue;
788 if (d_info[i].final_guardian)
790 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
792 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
794 sprintf(buf,_(" %c) %c%-12s : 最大 %d 階", " %c) %c%-16s : Max level %d"),
795 'a'+num, seiha ? '!' : ' ', d_name + d_info[i].name, (int)max_dlv[i]);
796 prt(buf, y + num, x);
802 prt(_(" 選べるダンジョンがない。", " No dungeon is available."), y, x);
805 prt(format(_("どのダンジョン%sしますか:", "Which dungeon do you %s?: "), note), 0, 0);
809 if ((i == ESCAPE) || !num)
811 /* Free the "dun" array */
812 C_KILL(dun, max_d_idx, s16b);
817 if (i >= 'a' && i <('a'+num))
819 select_dungeon = dun[i-'a'];
826 /* Free the "dun" array */
827 C_KILL(dun, max_d_idx, s16b);
829 return select_dungeon;
834 * @brief プレイヤーの帰還発動及び中止処理 /
835 * Recall the player to town or dungeon
836 * @param turns 発動までのターン数
839 bool recall_player(TIME_EFFECT turns)
842 * TODO: Recall the player to the last
843 * visited town when in the wilderness
847 if (p_ptr->inside_arena || ironman_downward)
849 msg_print(_("何も起こらなかった。", "Nothing happens."));
853 if (dun_level && (max_dlv[dungeon_type] > dun_level) && !p_ptr->inside_quest && !p_ptr->word_recall)
855 if (get_check(_("ここは最深到達階より浅い階です。この階に戻って来ますか? ", "Reset recall depth? ")))
857 max_dlv[dungeon_type] = dun_level;
859 do_cmd_write_nikki(NIKKI_TRUMP, dungeon_type, _("帰還のときに", "when recall from dungeon"));
863 if (!p_ptr->word_recall)
867 DUNGEON_IDX select_dungeon;
868 select_dungeon = choose_dungeon(_("に帰還", "recall"), 2, 14);
869 if (!select_dungeon) return FALSE;
870 p_ptr->recall_dungeon = select_dungeon;
872 p_ptr->word_recall = turns;
873 msg_print(_("回りの大気が張りつめてきた...", "The air about you becomes charged..."));
874 p_ptr->redraw |= (PR_STATUS);
878 p_ptr->word_recall = 0;
879 msg_print(_("張りつめた大気が流れ去った...", "A tension leaves the air around you..."));
880 p_ptr->redraw |= (PR_STATUS);
889 bool word_of_recall(void)
891 return(recall_player(randint0(21) + 15));
896 * @return リセット処理が実際に行われたらTRUEを返す
898 bool reset_recall(void)
900 int select_dungeon, dummy = 0;
904 select_dungeon = choose_dungeon(_("をセット", "reset"), 2, 14);
907 if (ironman_downward)
909 msg_print(_("何も起こらなかった。", "Nothing happens."));
913 if (!select_dungeon) return FALSE;
915 sprintf(ppp, _("何階にセットしますか (%d-%d):", "Reset to which level (%d-%d): "),
916 (int)d_info[select_dungeon].mindepth, (int)max_dlv[select_dungeon]);
919 sprintf(tmp_val, "%d", (int)MAX(dun_level, 1));
921 /* Ask for a level */
922 if (get_string(ppp, tmp_val, 10))
924 /* Extract request */
925 dummy = atoi(tmp_val);
928 if (dummy < 1) dummy = 1;
931 if (dummy > max_dlv[select_dungeon]) dummy = max_dlv[select_dungeon];
932 if (dummy < d_info[select_dungeon].mindepth) dummy = d_info[select_dungeon].mindepth;
934 max_dlv[select_dungeon] = dummy;
937 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, _("フロア・リセットで", "using a scroll of reset recall"));
940 msg_format("%sの帰還レベルを %d 階にセット。", d_name+d_info[select_dungeon].name, dummy, dummy * 50);
942 msg_format("Recall depth set to level %d (%d').", dummy, dummy * 50);
955 * @brief プレイヤーの装備劣化処理 /
956 * Apply disenchantment to the player's stuff
957 * @param mode 最下位ビットが1ならば劣化処理が若干低減される
958 * @return 劣化処理に関するメッセージが発せられた場合はTRUEを返す /
959 * Return "TRUE" if the player notices anything
961 bool apply_disenchant(BIT_FLAGS mode)
965 char o_name[MAX_NLEN];
966 int to_h, to_d, to_a, pval;
968 /* Pick a random slot */
971 case 1: t = INVEN_RARM; break;
972 case 2: t = INVEN_LARM; break;
973 case 3: t = INVEN_BOW; break;
974 case 4: t = INVEN_BODY; break;
975 case 5: t = INVEN_OUTER; break;
976 case 6: t = INVEN_HEAD; break;
977 case 7: t = INVEN_HANDS; break;
978 case 8: t = INVEN_FEET; break;
982 o_ptr = &inventory[t];
984 /* No item, nothing happens */
985 if (!o_ptr->k_idx) return (FALSE);
987 /* Disenchant equipments only -- No disenchant on monster ball */
988 if (!object_is_weapon_armour_ammo(o_ptr))
991 /* Nothing to disenchant */
992 if ((o_ptr->to_h <= 0) && (o_ptr->to_d <= 0) && (o_ptr->to_a <= 0) && (o_ptr->pval <= 1))
994 /* Nothing to notice */
999 /* Describe the object */
1000 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1003 /* Artifacts have 71% chance to resist */
1004 if (object_is_artifact(o_ptr) && (randint0(100) < 71))
1008 msg_format("%s(%c)は劣化を跳ね返した!",o_name, index_to_label(t) );
1010 msg_format("Your %s (%c) resist%s disenchantment!",
1011 o_name, index_to_label(t),
1012 ((o_ptr->number != 1) ? "" : "s"));
1021 /* Memorize old value */
1027 /* Disenchant tohit */
1028 if (o_ptr->to_h > 0) o_ptr->to_h--;
1029 if ((o_ptr->to_h > 5) && (randint0(100) < 20)) o_ptr->to_h--;
1031 /* Disenchant todam */
1032 if (o_ptr->to_d > 0) o_ptr->to_d--;
1033 if ((o_ptr->to_d > 5) && (randint0(100) < 20)) o_ptr->to_d--;
1035 /* Disenchant toac */
1036 if (o_ptr->to_a > 0) o_ptr->to_a--;
1037 if ((o_ptr->to_a > 5) && (randint0(100) < 20)) o_ptr->to_a--;
1039 /* Disenchant pval (occasionally) */
1040 /* Unless called from wild_magic() */
1041 if ((o_ptr->pval > 1) && one_in_(13) && !(mode & 0x01)) o_ptr->pval--;
1043 if ((to_h != o_ptr->to_h) || (to_d != o_ptr->to_d) ||
1044 (to_a != o_ptr->to_a) || (pval != o_ptr->pval))
1048 msg_format("%s(%c)は劣化してしまった!",
1049 o_name, index_to_label(t) );
1051 msg_format("Your %s (%c) %s disenchanted!",
1052 o_name, index_to_label(t),
1053 ((o_ptr->number != 1) ? "were" : "was"));
1056 chg_virtue(V_HARMONY, 1);
1057 chg_virtue(V_ENCHANT, -2);
1059 /* Recalculate bonuses */
1060 p_ptr->update |= (PU_BONUS);
1063 p_ptr->window |= (PW_EQUIP | PW_PLAYER);
1073 * @brief プレイヤーの突然変異処理
1076 void mutate_player(void)
1078 BASE_STATUS max1, cur1, max2, cur2;
1081 /* Pick a pair of stats */
1083 for (jj = ii; jj == ii; jj = randint0(6)) /* loop */;
1085 max1 = p_ptr->stat_max[ii];
1086 cur1 = p_ptr->stat_cur[ii];
1087 max2 = p_ptr->stat_max[jj];
1088 cur2 = p_ptr->stat_cur[jj];
1090 p_ptr->stat_max[ii] = max2;
1091 p_ptr->stat_cur[ii] = cur2;
1092 p_ptr->stat_max[jj] = max1;
1093 p_ptr->stat_cur[jj] = cur1;
1097 if(p_ptr->stat_max[i] > p_ptr->stat_max_max[i]) p_ptr->stat_max[i] = p_ptr->stat_max_max[i];
1098 if(p_ptr->stat_cur[i] > p_ptr->stat_max_max[i]) p_ptr->stat_cur[i] = p_ptr->stat_max_max[i];
1101 p_ptr->update |= (PU_BONUS);
1106 * @brief プレイヤーの因果混乱処理 / Apply Nexus
1107 * @param m_ptr 因果混乱をプレイヤーに与えたモンスターの情報参照ポインタ
1110 void apply_nexus(monster_type *m_ptr)
1112 switch (randint1(7))
1114 case 1: case 2: case 3:
1116 teleport_player(200, TELEPORT_PASSIVE);
1122 teleport_player_to(m_ptr->fy, m_ptr->fx, TELEPORT_PASSIVE);
1128 if (randint0(100) < p_ptr->skill_sav)
1130 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
1134 /* Teleport Level */
1141 if (randint0(100) < p_ptr->skill_sav)
1143 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
1147 msg_print(_("体がねじれ始めた...", "Your body starts to scramble..."));
1156 * @brief 寿命つき光源の燃素追加処理 /
1157 * Charge a lite (torch or latern)
1160 void phlogiston(void)
1162 GAME_TURN max_flog = 0;
1163 object_type * o_ptr = &inventory[INVEN_LITE];
1166 if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_LANTERN))
1168 max_flog = FUEL_LAMP;
1172 else if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_TORCH))
1174 max_flog = FUEL_TORCH;
1177 /* No torch to refill */
1180 msg_print(_("燃素を消費するアイテムを装備していません。", "You are not wielding anything which uses phlogiston."));
1184 if (o_ptr->xtra4 >= max_flog)
1186 msg_print(_("このアイテムにはこれ以上燃素を補充できません。", "No more phlogiston can be put in this item."));
1191 o_ptr->xtra4 += (XTRA16)(max_flog / 2);
1194 msg_print(_("照明用アイテムに燃素を補充した。", "You add phlogiston to your light item."));
1197 if (o_ptr->xtra4 >= max_flog)
1199 o_ptr->xtra4 = (XTRA16)max_flog;
1200 msg_print(_("照明用アイテムは満タンになった。", "Your light item is full."));
1203 /* Recalculate torch */
1204 p_ptr->update |= (PU_TORCH);
1209 * @brief 武器へのエゴ付加処理 /
1210 * Brand the current weapon
1211 * @param brand_type エゴ化ID(e_info.txtとは連動していない)
1214 void brand_weapon(int brand_type)
1221 /* Assume enchant weapon */
1222 item_tester_hook = object_allow_enchant_melee_weapon;
1223 item_tester_no_ryoute = TRUE;
1226 q = _("どの武器を強化しますか? ", "Enchant which weapon? ");
1227 s = _("強化できる武器がない。", "You have nothing to enchant.");
1229 if (!get_item(&item, q, s, (USE_EQUIP))) return;
1231 /* Get the item (in the pack) */
1234 o_ptr = &inventory[item];
1237 /* Get the item (on the floor) */
1240 o_ptr = &o_list[0 - item];
1244 /* you can never modify artifacts / ego-items */
1245 /* you can never modify cursed items */
1246 /* TY: You _can_ modify broken items (if you're silly enough) */
1247 if (o_ptr->k_idx && !object_is_artifact(o_ptr) && !object_is_ego(o_ptr) &&
1248 !object_is_cursed(o_ptr) &&
1249 !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) &&
1250 !((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE)) &&
1251 !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DIAMOND_EDGE)))
1255 /* Let's get the name before it is changed... */
1256 char o_name[MAX_NLEN];
1257 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1262 if (o_ptr->tval == TV_SWORD)
1264 act = _("は鋭さを増した!", "becomes very sharp!");
1266 o_ptr->name2 = EGO_SHARPNESS;
1267 o_ptr->pval = (PARAMETER_VALUE)m_bonus(5, dun_level) + 1;
1269 if ((o_ptr->sval == SV_HAYABUSA) && (o_ptr->pval > 2))
1274 act = _("は破壊力を増した!", "seems very powerful.");
1275 o_ptr->name2 = EGO_EARTHQUAKES;
1276 o_ptr->pval = (PARAMETER_VALUE)m_bonus(3, dun_level);
1280 act = _("は人間の血を求めている!", "seems to be looking for humans!");
1281 o_ptr->name2 = EGO_KILL_HUMAN;
1284 act = _("は電撃に覆われた!", "covered with lightning!");
1285 o_ptr->name2 = EGO_BRAND_ELEC;
1288 act = _("は酸に覆われた!", "coated with acid!");
1289 o_ptr->name2 = EGO_BRAND_ACID;
1292 act = _("は邪悪なる怪物を求めている!", "seems to be looking for evil monsters!");
1293 o_ptr->name2 = EGO_KILL_EVIL;
1296 act = _("は異世界の住人の肉体を求めている!", "seems to be looking for demons!");
1297 o_ptr->name2 = EGO_KILL_DEMON;
1300 act = _("は屍を求めている!", "seems to be looking for undead!");
1301 o_ptr->name2 = EGO_KILL_UNDEAD;
1304 act = _("は動物の血を求めている!", "seems to be looking for animals!");
1305 o_ptr->name2 = EGO_KILL_ANIMAL;
1308 act = _("はドラゴンの血を求めている!", "seems to be looking for dragons!");
1309 o_ptr->name2 = EGO_KILL_DRAGON;
1312 act = _("はトロルの血を求めている!", "seems to be looking for troll!s");
1313 o_ptr->name2 = EGO_KILL_TROLL;
1316 act = _("はオークの血を求めている!", "seems to be looking for orcs!");
1317 o_ptr->name2 = EGO_KILL_ORC;
1320 act = _("は巨人の血を求めている!", "seems to be looking for giants!");
1321 o_ptr->name2 = EGO_KILL_GIANT;
1324 act = _("は非常に不安定になったようだ。", "seems very unstable now.");
1325 o_ptr->name2 = EGO_TRUMP;
1326 o_ptr->pval = randint1(2);
1329 act = _("は血を求めている!", "thirsts for blood!");
1330 o_ptr->name2 = EGO_VAMPIRIC;
1333 act = _("は毒に覆われた。", "is coated with poison.");
1334 o_ptr->name2 = EGO_BRAND_POIS;
1337 act = _("は純ログルスに飲み込まれた。", "is engulfed in raw Logrus!");
1338 o_ptr->name2 = EGO_CHAOTIC;
1341 act = _("は炎のシールドに覆われた!", "is covered in a fiery shield!");
1342 o_ptr->name2 = EGO_BRAND_FIRE;
1345 act = _("は深く冷たいブルーに輝いた!", "glows deep, icy blue!");
1346 o_ptr->name2 = EGO_BRAND_COLD;
1350 msg_format(_("あなたの%s%s", "Your %s %s"), o_name, act);
1351 enchant(o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
1353 o_ptr->discount = 99;
1354 chg_virtue(V_ENCHANT, 2);
1358 if (flush_failure) flush();
1360 msg_print(_("属性付加に失敗した。", "The Branding failed."));
1361 chg_virtue(V_ENCHANT, -2);
1368 * @brief 虚無招来によるフロア中の全壁除去処理 /
1369 * Vanish all walls in this floor
1370 * @return 実際に処理が反映された場合TRUE
1372 static bool vanish_dungeon(void)
1376 feature_type *f_ptr;
1377 monster_type *m_ptr;
1380 /* Prevent vasishing of quest levels and town */
1381 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1386 /* Scan all normal grids */
1387 for (y = 1; y < cur_hgt - 1; y++)
1389 for (x = 1; x < cur_wid - 1; x++)
1391 c_ptr = &cave[y][x];
1393 /* Seeing true feature code (ignore mimic) */
1394 f_ptr = &f_info[c_ptr->feat];
1396 /* Lose room and vault */
1397 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1399 m_ptr = &m_list[c_ptr->m_idx];
1402 if (c_ptr->m_idx && MON_CSLEEP(m_ptr))
1404 /* Reset sleep counter */
1405 (void)set_monster_csleep(c_ptr->m_idx, 0);
1407 /* Notice the "waking up" */
1410 /* Acquire the monster name */
1411 monster_desc(m_name, m_ptr, 0);
1413 /* Dump a message */
1414 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1418 /* Process all walls, doors and patterns */
1419 if (have_flag(f_ptr->flags, FF_HURT_DISI)) cave_alter_feat(y, x, FF_HURT_DISI);
1423 /* Special boundary walls -- Top and bottom */
1424 for (x = 0; x < cur_wid; x++)
1426 c_ptr = &cave[0][x];
1427 f_ptr = &f_info[c_ptr->mimic];
1429 /* Lose room and vault */
1430 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1432 /* Set boundary mimic if needed */
1433 if (c_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI))
1435 c_ptr->mimic = feat_state(c_ptr->mimic, FF_HURT_DISI);
1437 /* Check for change to boring grid */
1438 if (!have_flag(f_info[c_ptr->mimic].flags, FF_REMEMBER)) c_ptr->info &= ~(CAVE_MARK);
1441 c_ptr = &cave[cur_hgt - 1][x];
1442 f_ptr = &f_info[c_ptr->mimic];
1444 /* Lose room and vault */
1445 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1447 /* Set boundary mimic if needed */
1448 if (c_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI))
1450 c_ptr->mimic = feat_state(c_ptr->mimic, FF_HURT_DISI);
1452 /* Check for change to boring grid */
1453 if (!have_flag(f_info[c_ptr->mimic].flags, FF_REMEMBER)) c_ptr->info &= ~(CAVE_MARK);
1457 /* Special boundary walls -- Left and right */
1458 for (y = 1; y < (cur_hgt - 1); y++)
1460 c_ptr = &cave[y][0];
1461 f_ptr = &f_info[c_ptr->mimic];
1463 /* Lose room and vault */
1464 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1466 /* Set boundary mimic if needed */
1467 if (c_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI))
1469 c_ptr->mimic = feat_state(c_ptr->mimic, FF_HURT_DISI);
1471 /* Check for change to boring grid */
1472 if (!have_flag(f_info[c_ptr->mimic].flags, FF_REMEMBER)) c_ptr->info &= ~(CAVE_MARK);
1475 c_ptr = &cave[y][cur_wid - 1];
1476 f_ptr = &f_info[c_ptr->mimic];
1478 /* Lose room and vault */
1479 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1481 /* Set boundary mimic if needed */
1482 if (c_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI))
1484 c_ptr->mimic = feat_state(c_ptr->mimic, FF_HURT_DISI);
1486 /* Check for change to boring grid */
1487 if (!have_flag(f_info[c_ptr->mimic].flags, FF_REMEMBER)) c_ptr->info &= ~(CAVE_MARK);
1491 /* Mega-Hack -- Forget the view and lite */
1492 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1495 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
1497 /* Update the monsters */
1498 p_ptr->update |= (PU_MONSTERS);
1501 p_ptr->redraw |= (PR_MAP);
1504 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1513 void call_the_(void)
1517 bool do_call = TRUE;
1519 for (i = 0; i < 9; i++)
1521 c_ptr = &cave[p_ptr->y + ddy_ddd[i]][p_ptr->x + ddx_ddd[i]];
1523 if (!cave_have_flag_grid(c_ptr, FF_PROJECT))
1525 if (!c_ptr->mimic || !have_flag(f_info[c_ptr->mimic].flags, FF_PROJECT) ||
1526 !permanent_wall(&f_info[c_ptr->feat]))
1536 for (i = 1; i < 10; i++)
1538 if (i - 5) fire_ball(GF_ROCKET, i, 175, 2);
1541 for (i = 1; i < 10; i++)
1543 if (i - 5) fire_ball(GF_MANA, i, 175, 3);
1546 for (i = 1; i < 10; i++)
1548 if (i - 5) fire_ball(GF_NUKE, i, 175, 4);
1552 /* Prevent destruction of quest levels and town */
1553 else if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1555 msg_print(_("地面が揺れた。", "The ground trembles."));
1561 msg_format("あなたは%sを壁に近すぎる場所で唱えてしまった!",
1562 ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "祈り" : "呪文"));
1563 msg_print("大きな爆発音があった!");
1565 msg_format("You %s the %s too close to a wall!",
1566 ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "recite" : "cast"),
1567 ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "prayer" : "spell"));
1568 msg_print("There is a loud explosion!");
1573 if (!vanish_dungeon()) msg_print(_("ダンジョンは一瞬静まり返った。", "The dungeon silences a moment."));
1577 if (destroy_area(p_ptr->y, p_ptr->x, 15 + p_ptr->lev + randint0(11), FALSE))
1578 msg_print(_("ダンジョンが崩壊した...", "The dungeon collapses..."));
1580 msg_print(_("ダンジョンは大きく揺れた。", "The dungeon trembles."));
1583 take_hit(DAMAGE_NOESCAPE, 100 + randint1(150), _("自殺的な虚無招来", "a suicidal Call the Void"), -1);
1589 * @brief アイテム引き寄せ処理 /
1590 * Fetch an item (teleport it right underneath the caster)
1591 * @param dir 魔法の発動方向
1593 * @param require_los 射線の通りを要求するならばTRUE
1596 void fetch(DIRECTION dir, WEIGHT wgt, bool require_los)
1602 char o_name[MAX_NLEN];
1604 /* Check to see if an object is already there */
1605 if (cave[p_ptr->y][p_ptr->x].o_idx)
1607 msg_print(_("自分の足の下にある物は取れません。", "You can't fetch when you're already standing on something."));
1612 if (dir == 5 && target_okay())
1617 if (distance(p_ptr->y, p_ptr->x, ty, tx) > MAX_RANGE)
1619 msg_print(_("そんなに遠くにある物は取れません!", "You can't fetch something that far away!"));
1623 c_ptr = &cave[ty][tx];
1625 /* We need an item to fetch */
1628 msg_print(_("そこには何もありません。", "There is no object at this place."));
1632 /* No fetching from vault */
1633 if (c_ptr->info & CAVE_ICKY)
1635 msg_print(_("アイテムがコントロールを外れて落ちた。", "The item slips from your control."));
1639 /* We need to see the item */
1642 if (!player_has_los_bold(ty, tx))
1644 msg_print(_("そこはあなたの視界に入っていません。", "You have no direct line of sight to that location."));
1647 else if (!projectable(p_ptr->y, p_ptr->x, ty, tx))
1649 msg_print(_("そこは壁の向こうです。", "You have no direct line of sight to that location."));
1656 /* Use a direction */
1657 ty = p_ptr->y; /* Where to drop the item */
1664 c_ptr = &cave[ty][tx];
1666 if ((distance(p_ptr->y, p_ptr->x, ty, tx) > MAX_RANGE) ||
1667 !cave_have_flag_bold(ty, tx, FF_PROJECT)) return;
1669 while (!c_ptr->o_idx);
1672 o_ptr = &o_list[c_ptr->o_idx];
1674 if (o_ptr->weight > wgt)
1676 /* Too heavy to 'fetch' */
1677 msg_print(_("そのアイテムは重過ぎます。", "The object is too heavy."));
1682 c_ptr->o_idx = o_ptr->next_o_idx;
1683 cave[p_ptr->y][p_ptr->x].o_idx = i; /* 'move' it */
1685 o_ptr->next_o_idx = 0;
1686 o_ptr->iy = (byte)p_ptr->y;
1687 o_ptr->ix = (byte)p_ptr->x;
1689 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1690 msg_format(_("%^sがあなたの足元に飛んできた。", "%^s flies through the air to your feet."), o_name);
1692 note_spot(p_ptr->y, p_ptr->x);
1693 p_ptr->redraw |= PR_MAP;
1700 void alter_reality(void)
1702 /* Ironman option */
1703 if (p_ptr->inside_arena || ironman_downward)
1705 msg_print(_("何も起こらなかった。", "Nothing happens."));
1709 if (!p_ptr->alter_reality)
1711 TIME_EFFECT turns = randint0(21) + 15;
1713 p_ptr->alter_reality = turns;
1714 msg_print(_("回りの景色が変わり始めた...", "The view around you begins to change..."));
1716 p_ptr->redraw |= (PR_STATUS);
1720 p_ptr->alter_reality = 0;
1721 msg_print(_("景色が元に戻った...", "The view around you got back..."));
1722 p_ptr->redraw |= (PR_STATUS);
1729 * @brief 守りのルーン設置処理 /
1730 * Leave a "glyph of warding" which prevents monster movement
1731 * @return 実際に設置が行われた場合TRUEを返す
1733 bool warding_glyph(void)
1736 if (!cave_clean_bold(p_ptr->y, p_ptr->x))
1738 msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
1742 /* Create a glyph */
1743 cave[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT;
1744 cave[p_ptr->y][p_ptr->x].mimic = feat_glyph;
1747 note_spot(p_ptr->y, p_ptr->x);
1750 lite_spot(p_ptr->y, p_ptr->x);
1757 * @return 実際に設置が行われた場合TRUEを返す
1759 bool place_mirror(void)
1762 if (!cave_clean_bold(p_ptr->y, p_ptr->x))
1764 msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
1768 /* Create a mirror */
1769 cave[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT;
1770 cave[p_ptr->y][p_ptr->x].mimic = feat_mirror;
1772 /* Turn on the light */
1773 cave[p_ptr->y][p_ptr->x].info |= CAVE_GLOW;
1776 note_spot(p_ptr->y, p_ptr->x);
1779 lite_spot(p_ptr->y, p_ptr->x);
1781 update_local_illumination(p_ptr->y, p_ptr->x);
1788 * @brief 爆発のルーン設置処理 /
1789 * Leave an "explosive rune" which prevents monster movement
1790 * @return 実際に設置が行われた場合TRUEを返す
1792 bool explosive_rune(void)
1795 if (!cave_clean_bold(p_ptr->y, p_ptr->x))
1797 msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
1801 /* Create a glyph */
1802 cave[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT;
1803 cave[p_ptr->y][p_ptr->x].mimic = feat_explosive_rune;
1806 note_spot(p_ptr->y, p_ptr->x);
1809 lite_spot(p_ptr->y, p_ptr->x);
1816 * @brief 全所持アイテム鑑定処理 /
1817 * Identify everything being carried.
1818 * Done by a potion of "self knowledge".
1821 void identify_pack(void)
1825 /* Simply identify and know every item */
1826 for (i = 0; i < INVEN_TOTAL; i++)
1828 object_type *o_ptr = &inventory[i];
1830 /* Skip non-objects */
1831 if (!o_ptr->k_idx) continue;
1834 identify_item(o_ptr);
1836 /* Auto-inscription */
1837 autopick_alter_item(i, FALSE);
1843 * @brief 装備強化処理の失敗率定数(千分率) /
1844 * Used by the "enchant" function (chance of failure)
1845 * (modified for Zangband, we need better stuff there...) -- TY
1848 static int enchant_table[16] =
1850 0, 10, 50, 100, 200,
1851 300, 400, 500, 650, 800,
1852 950, 987, 993, 995, 998,
1859 * Removes curses from items in inventory
1860 * @param all 軽い呪いまでの解除ならば0
1861 * @return 解呪されたアイテムの数
1864 * Note that Items which are "Perma-Cursed" (The One Ring,
1865 * The Crown of Morgoth) can NEVER be uncursed.
1867 * Note that if "all" is FALSE, then Items which are
1868 * "Heavy-Cursed" (Mormegil, Calris, and Weapons of Morgul)
1869 * will not be uncursed.
1872 static int remove_curse_aux(int all)
1876 /* Attempt to uncurse items being worn */
1877 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1879 object_type *o_ptr = &inventory[i];
1881 /* Skip non-objects */
1882 if (!o_ptr->k_idx) continue;
1884 /* Uncursed already */
1885 if (!object_is_cursed(o_ptr)) continue;
1887 /* Heavily Cursed Items need a special spell */
1888 if (!all && (o_ptr->curse_flags & TRC_HEAVY_CURSE)) continue;
1890 /* Perma-Cursed Items can NEVER be uncursed */
1891 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1894 o_ptr->curse_flags &= (TRC_CURSED | TRC_HEAVY_CURSE | TRC_PERMA_CURSE);
1899 o_ptr->curse_flags = 0L;
1901 /* Hack -- Assume felt */
1902 o_ptr->ident |= (IDENT_SENSE);
1905 o_ptr->feeling = FEEL_NONE;
1907 /* Recalculate the bonuses */
1908 p_ptr->update |= (PU_BONUS);
1911 p_ptr->window |= (PW_EQUIP);
1913 /* Count the uncursings */
1917 /* Return "something uncursed" */
1923 * @brief 装備の軽い呪い解呪処理 /
1924 * Remove most curses
1925 * @return 解呪に成功した装備数
1927 int remove_curse(void)
1929 return (remove_curse_aux(FALSE));
1933 * @brief 装備の重い呪い解呪処理 /
1935 * @return 解呪に成功した装備数
1937 int remove_all_curse(void)
1939 return (remove_curse_aux(TRUE));
1944 * @brief アイテムの価値に応じた錬金術処理 /
1945 * Turns an object into gold, gain some of its value in a shop
1946 * @return 処理が実際に行われたらTRUEを返す
1952 ITEM_NUMBER old_number;
1956 char o_name[MAX_NLEN];
1957 char out_val[MAX_NLEN+40];
1961 /* Hack -- force destruction */
1962 if (command_arg > 0) force = TRUE;
1965 q = _("どのアイテムを金に変えますか?", "Turn which item to gold? ");
1966 s = _("金に変えられる物がありません。", "You have nothing to turn to gold.");
1968 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return (FALSE);
1970 /* Get the item (in the pack) */
1973 o_ptr = &inventory[item];
1976 /* Get the item (on the floor) */
1979 o_ptr = &o_list[0 - item];
1983 /* See how many items */
1984 if (o_ptr->number > 1)
1986 /* Get a quantity */
1987 amt = get_quantity(NULL, o_ptr->number);
1989 /* Allow user abort */
1990 if (amt <= 0) return FALSE;
1994 /* Describe the object */
1995 old_number = o_ptr->number;
1996 o_ptr->number = amt;
1997 object_desc(o_name, o_ptr, 0);
1998 o_ptr->number = old_number;
2000 /* Verify unless quantity given */
2003 if (confirm_destroy || (object_value(o_ptr) > 0))
2005 /* Make a verification */
2006 sprintf(out_val, _("本当に%sを金に変えますか?", "Really turn %s to gold? "), o_name);
2007 if (!get_check(out_val)) return FALSE;
2011 /* Artifacts cannot be destroyed */
2012 if (!can_player_destroy_object(o_ptr))
2015 msg_format(_("%sを金に変えることに失敗した。", "You fail to turn %s to gold!"), o_name);
2021 price = object_value_real(o_ptr);
2026 msg_format(_("%sをニセの金に変えた。", "You turn %s to fool's gold."), o_name);
2032 if (amt > 1) price *= amt;
2034 if (price > 30000) price = 30000;
2035 msg_format(_("%sを$%d の金に変えた。", "You turn %s to %ld coins worth of gold."), o_name, price);
2040 p_ptr->redraw |= (PR_GOLD);
2043 p_ptr->window |= (PW_PLAYER);
2047 /* Eliminate the item (from the pack) */
2050 inven_item_increase(item, -amt);
2051 inven_item_describe(item);
2052 inven_item_optimize(item);
2055 /* Eliminate the item (from the floor) */
2058 floor_item_increase(0 - item, -amt);
2059 floor_item_describe(0 - item);
2060 floor_item_optimize(0 - item);
2068 * @brief 呪いの打ち破り処理 /
2069 * Break the curse of an item
2070 * @param o_ptr 呪い装備情報の参照ポインタ
2073 static void break_curse(object_type *o_ptr)
2075 if (object_is_cursed(o_ptr) && !(o_ptr->curse_flags & TRC_PERMA_CURSE) && !(o_ptr->curse_flags & TRC_HEAVY_CURSE) && (randint0(100) < 25))
2077 msg_print(_("かけられていた呪いが打ち破られた!", "The curse is broken!"));
2079 o_ptr->curse_flags = 0L;
2080 o_ptr->ident |= (IDENT_SENSE);
2081 o_ptr->feeling = FEEL_NONE;
2088 * Enchants a plus onto an item. -RAK-
2089 * @param o_ptr 強化するアイテムの参照ポインタ
2091 * @param eflag 強化オプション(命中/ダメージ/AC)
2092 * @return 強化に成功した場合TRUEを返す
2095 * Revamped! Now takes item pointer, number of times to try enchanting,
2096 * and a flag of what to try enchanting. Artifacts resist enchantment
2097 * some of the time, and successful enchantment to at least +0 might
2098 * break a curse on the item. -CFT-
2100 * Note that an item can technically be enchanted all the way to +15 if
2101 * you wait a very, very, long time. Going from +9 to +10 only works
2102 * about 5% of the time, and from +10 to +11 only about 1% of the time.
2104 * Note that this function can now be used on "piles" of items, and
2105 * the larger the pile, the lower the chance of success.
2108 bool enchant(object_type *o_ptr, int n, int eflag)
2110 int i, chance, prob;
2112 bool a = object_is_artifact(o_ptr);
2113 bool force = (eflag & ENCH_FORCE);
2116 /* Large piles resist enchantment */
2117 prob = o_ptr->number * 100;
2119 /* Missiles are easy to enchant */
2120 if ((o_ptr->tval == TV_BOLT) ||
2121 (o_ptr->tval == TV_ARROW) ||
2122 (o_ptr->tval == TV_SHOT))
2128 for (i = 0; i < n; i++)
2130 /* Hack -- Roll for pile resistance */
2131 if (!force && randint0(prob) >= 100) continue;
2133 /* Enchant to hit */
2134 if (eflag & ENCH_TOHIT)
2136 if (o_ptr->to_h < 0) chance = 0;
2137 else if (o_ptr->to_h > 15) chance = 1000;
2138 else chance = enchant_table[o_ptr->to_h];
2140 if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
2145 /* only when you get it above -1 -CFT */
2146 if (o_ptr->to_h >= 0)
2151 /* Enchant to damage */
2152 if (eflag & ENCH_TODAM)
2154 if (o_ptr->to_d < 0) chance = 0;
2155 else if (o_ptr->to_d > 15) chance = 1000;
2156 else chance = enchant_table[o_ptr->to_d];
2158 if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
2163 /* only when you get it above -1 -CFT */
2164 if (o_ptr->to_d >= 0)
2169 /* Enchant to armor class */
2170 if (eflag & ENCH_TOAC)
2172 if (o_ptr->to_a < 0) chance = 0;
2173 else if (o_ptr->to_a > 15) chance = 1000;
2174 else chance = enchant_table[o_ptr->to_a];
2176 if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
2181 /* only when you get it above -1 -CFT */
2182 if (o_ptr->to_a >= 0)
2189 if (!res) return (FALSE);
2191 /* Recalculate bonuses */
2192 p_ptr->update |= (PU_BONUS);
2194 /* Combine / Reorder the pack (later) */
2195 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2198 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2208 * @brief 装備修正強化処理のメインルーチン /
2209 * Enchant an item (in the inventory or on the floor)
2210 * @param num_hit 命中修正量
2211 * @param num_dam ダメージ修正量
2212 * @param num_ac AC修正量
2213 * @return 強化に成功した場合TRUEを返す
2215 * Note that "num_ac" requires armour, else weapon
2216 * Returns TRUE if attempted, FALSE if cancelled
2218 bool enchant_spell(HIT_PROB num_hit, HIT_POINT num_dam, ARMOUR_CLASS num_ac)
2223 char o_name[MAX_NLEN];
2227 /* Assume enchant weapon */
2228 item_tester_hook = object_allow_enchant_weapon;
2229 item_tester_no_ryoute = TRUE;
2231 /* Enchant armor if requested */
2232 if (num_ac) item_tester_hook = object_is_armour;
2235 q = _("どのアイテムを強化しますか? ", "Enchant which item? ");
2236 s = _("強化できるアイテムがない。", "You have nothing to enchant.");
2238 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2240 /* Get the item (in the pack) */
2243 o_ptr = &inventory[item];
2246 /* Get the item (on the floor) */
2249 o_ptr = &o_list[0 - item];
2254 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2258 msg_format("%s は明るく輝いた!",
2261 msg_format("%s %s glow%s brightly!",
2262 ((item >= 0) ? "Your" : "The"), o_name,
2263 ((o_ptr->number > 1) ? "" : "s"));
2268 if (enchant(o_ptr, num_hit, ENCH_TOHIT)) okay = TRUE;
2269 if (enchant(o_ptr, num_dam, ENCH_TODAM)) okay = TRUE;
2270 if (enchant(o_ptr, num_ac, ENCH_TOAC)) okay = TRUE;
2276 if (flush_failure) flush();
2279 msg_print(_("強化に失敗した。", "The enchantment failed."));
2281 if (one_in_(3)) chg_virtue(V_ENCHANT, -1);
2284 chg_virtue(V_ENCHANT, 1);
2288 /* Something happened */
2294 * @brief アーティファクト生成の巻物処理 /
2295 * @return 生成が実際に試みられたらTRUEを返す
2297 bool artifact_scroll(void)
2302 char o_name[MAX_NLEN];
2306 item_tester_no_ryoute = TRUE;
2308 /* Enchant weapon/armour */
2309 item_tester_hook = item_tester_hook_nameless_weapon_armour;
2312 q = _("どのアイテムを強化しますか? ", "Enchant which item? ");
2313 s = _("強化できるアイテムがない。", "You have nothing to enchant.");
2315 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2317 /* Get the item (in the pack) */
2320 o_ptr = &inventory[item];
2323 /* Get the item (on the floor) */
2326 o_ptr = &o_list[0 - item];
2331 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2335 msg_format("%s は眩い光を発した!",o_name);
2337 msg_format("%s %s radiate%s a blinding light!",
2338 ((item >= 0) ? "Your" : "The"), o_name,
2339 ((o_ptr->number > 1) ? "" : "s"));
2342 if (object_is_artifact(o_ptr))
2345 msg_format("%sは既に伝説のアイテムです!", o_name );
2347 msg_format("The %s %s already %s!",
2348 o_name, ((o_ptr->number > 1) ? "are" : "is"),
2349 ((o_ptr->number > 1) ? "artifacts" : "an artifact"));
2355 else if (object_is_ego(o_ptr))
2358 msg_format("%sは既に名のあるアイテムです!", o_name );
2360 msg_format("The %s %s already %s!",
2361 o_name, ((o_ptr->number > 1) ? "are" : "is"),
2362 ((o_ptr->number > 1) ? "ego items" : "an ego item"));
2368 else if (o_ptr->xtra3)
2371 msg_format("%sは既に強化されています!", o_name );
2373 msg_format("The %s %s already %s!",
2374 o_name, ((o_ptr->number > 1) ? "are" : "is"),
2375 ((o_ptr->number > 1) ? "customized items" : "a customized item"));
2381 if (o_ptr->number > 1)
2384 msg_print("複数のアイテムに魔法をかけるだけのエネルギーはありません!");
2385 msg_format("%d 個の%sが壊れた!",(o_ptr->number)-1, o_name);
2387 msg_print("Not enough enough energy to enchant more than one object!");
2388 msg_format("%d of your %s %s destroyed!",(o_ptr->number)-1, o_name, (o_ptr->number>2?"were":"was"));
2393 inven_item_increase(item, 1-(o_ptr->number));
2397 floor_item_increase(0-item, 1-(o_ptr->number));
2400 okay = create_artifact(o_ptr, TRUE);
2407 if (flush_failure) flush();
2410 msg_print(_("強化に失敗した。", "The enchantment failed."));
2412 if (one_in_(3)) chg_virtue(V_ENCHANT, -1);
2416 if (record_rand_art)
2419 object_desc(o_name, o_ptr, OD_NAME_ONLY);
2420 do_cmd_write_nikki(NIKKI_ART_SCROLL, 0, o_name);
2422 chg_virtue(V_ENCHANT, 1);
2427 /* Something happened */
2434 * Identify an object
2435 * @param o_ptr 鑑定されるアイテムの情報参照ポインタ
2436 * @return 実際に鑑定できたらTRUEを返す
2438 bool identify_item(object_type *o_ptr)
2440 bool old_known = FALSE;
2441 char o_name[MAX_NLEN];
2444 object_desc(o_name, o_ptr, 0);
2446 if (o_ptr->ident & IDENT_KNOWN)
2449 if (!(o_ptr->ident & (IDENT_MENTAL)))
2451 if (object_is_artifact(o_ptr) || one_in_(5))
2452 chg_virtue(V_KNOWLEDGE, 1);
2455 /* Identify it fully */
2456 object_aware(o_ptr);
2457 object_known(o_ptr);
2459 /* Player touches it */
2460 o_ptr->marked |= OM_TOUCHED;
2462 /* Recalculate bonuses */
2463 p_ptr->update |= (PU_BONUS);
2465 /* Combine / Reorder the pack (later) */
2466 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2469 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2471 strcpy(record_o_name, o_name);
2475 object_desc(o_name, o_ptr, OD_NAME_ONLY);
2477 if(record_fix_art && !old_known && object_is_fixed_artifact(o_ptr))
2478 do_cmd_write_nikki(NIKKI_ART, 0, o_name);
2479 if(record_rand_art && !old_known && o_ptr->art_name)
2480 do_cmd_write_nikki(NIKKI_ART, 0, o_name);
2486 * @brief アイテム鑑定のメインルーチン処理 /
2487 * Identify an object in the inventory (or on the floor)
2488 * @param only_equip 装備品のみを対象とするならばTRUEを返す
2489 * @return 実際に鑑定を行ったならばTRUEを返す
2491 * This routine does *not* automatically combine objects.
2492 * Returns TRUE if something was identified, else FALSE.
2494 bool ident_spell(bool only_equip)
2498 char o_name[MAX_NLEN];
2502 item_tester_no_ryoute = TRUE;
2505 item_tester_hook = item_tester_hook_identify_weapon_armour;
2507 item_tester_hook = item_tester_hook_identify;
2511 q = _("どのアイテムを鑑定しますか? ", "Identify which item? ");
2516 item_tester_hook = object_is_weapon_armour_ammo;
2518 item_tester_hook = NULL;
2520 q = _("すべて鑑定済みです。 ", "All items are identified. ");
2524 s = _("鑑定するべきアイテムがない。", "You have nothing to identify.");
2526 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2528 /* Get the item (in the pack) */
2531 o_ptr = &inventory[item];
2534 /* Get the item (on the floor) */
2537 o_ptr = &o_list[0 - item];
2541 old_known = identify_item(o_ptr);
2544 object_desc(o_name, o_ptr, 0);
2547 if (item >= INVEN_RARM)
2549 msg_format(_("%^s: %s(%c)。", "%^s: %s (%c)."), describe_use(item), o_name, index_to_label(item));
2553 msg_format(_("ザック中: %s(%c)。", "In your pack: %s (%c)."), o_name, index_to_label(item));
2557 msg_format(_("床上: %s。", "On the ground: %s."), o_name);
2560 /* Auto-inscription/destroy */
2561 autopick_alter_item(item, (bool)(destroy_identify && !old_known));
2563 /* Something happened */
2569 * @brief アイテム凡庸化のメインルーチン処理 /
2570 * Identify an object in the inventory (or on the floor)
2571 * @param only_equip 装備品のみを対象とするならばTRUEを返す
2572 * @return 実際に凡庸化をを行ったならばTRUEを返す
2575 * Mundanify an object in the inventory (or on the floor)
2576 * This routine does *not* automatically combine objects.
2577 * Returns TRUE if something was mundanified, else FALSE.
2580 bool mundane_spell(bool only_equip)
2586 if (only_equip) item_tester_hook = object_is_weapon_armour_ammo;
2587 item_tester_no_ryoute = TRUE;
2590 q = _("どれを使いますか?", "Use which item? ");
2591 s = _("使えるものがありません。", "You have nothing you can use.");
2593 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2595 /* Get the item (in the pack) */
2598 o_ptr = &inventory[item];
2601 /* Get the item (on the floor) */
2604 o_ptr = &o_list[0 - item];
2608 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
2610 POSITION iy = o_ptr->iy; /* Y-position on map, or zero */
2611 POSITION ix = o_ptr->ix; /* X-position on map, or zero */
2612 s16b next_o_idx = o_ptr->next_o_idx; /* Next object in stack (if any) */
2613 byte marked = o_ptr->marked; /* Object is marked */
2614 s16b weight = o_ptr->number * o_ptr->weight;
2615 u16b inscription = o_ptr->inscription;
2618 object_prep(o_ptr, o_ptr->k_idx);
2622 o_ptr->next_o_idx = next_o_idx;
2623 o_ptr->marked = marked;
2624 o_ptr->inscription = inscription;
2625 if (item >= 0) p_ptr->total_weight += (o_ptr->weight - weight);
2629 /* Something happened */
2634 * @brief アイテム*鑑定*のメインルーチン処理 /
2635 * Identify an object in the inventory (or on the floor)
2636 * @param only_equip 装備品のみを対象とするならばTRUEを返す
2637 * @return 実際に鑑定を行ったならばTRUEを返す
2639 * Fully "identify" an object in the inventory -BEN-
2640 * This routine returns TRUE if an item was identified.
2642 bool identify_fully(bool only_equip)
2646 char o_name[MAX_NLEN];
2650 item_tester_no_ryoute = TRUE;
2652 item_tester_hook = item_tester_hook_identify_fully_weapon_armour;
2654 item_tester_hook = item_tester_hook_identify_fully;
2658 q = _("どのアイテムを*鑑定*しますか? ", "*Identify* which item? ");
2663 item_tester_hook = object_is_weapon_armour_ammo;
2665 item_tester_hook = NULL;
2667 q = _("すべて*鑑定*済みです。 ", "All items are *identified*. ");
2671 s = _("*鑑定*するべきアイテムがない。", "You have nothing to *identify*.");
2673 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2675 /* Get the item (in the pack) */
2678 o_ptr = &inventory[item];
2681 /* Get the item (on the floor) */
2684 o_ptr = &o_list[0 - item];
2688 old_known = identify_item(o_ptr);
2690 /* Mark the item as fully known */
2691 o_ptr->ident |= (IDENT_MENTAL);
2697 object_desc(o_name, o_ptr, 0);
2700 if (item >= INVEN_RARM)
2702 msg_format(_("%^s: %s(%c)。", "%^s: %s (%c)."), describe_use(item), o_name, index_to_label(item));
2706 msg_format(_("ザック中: %s(%c)。", "In your pack: %s (%c)."), o_name, index_to_label(item));
2710 msg_format(_("床上: %s。", "On the ground: %s."), o_name);
2713 /* Describe it fully */
2714 (void)screen_object(o_ptr, 0L);
2716 /* Auto-inscription/destroy */
2717 autopick_alter_item(item, (bool)(destroy_identify && !old_known));
2727 * Recharge a wand/staff/rod from the pack or on the floor.
2728 * This function has been rewritten in Oangband and ZAngband.
2729 * @param power 充填パワー
2730 * @return ターン消費を要する処理まで進んだらTRUEを返す
2732 * Sorcery/Arcane -- Recharge --> recharge(plev * 4)
2733 * Chaos -- Arcane Binding --> recharge(90)
2735 * Scroll of recharging --> recharge(130)
2736 * Artifact activation/Thingol --> recharge(130)
2738 * It is harder to recharge high level, and highly charged wands,
2739 * staffs, and rods. The more wands in a stack, the more easily and
2740 * strongly they recharge. Staffs, however, each get fewer charges if
2743 * XXX XXX XXX Beware of "sliding index errors".
2745 bool recharge(int power)
2749 int recharge_strength;
2750 TIME_EFFECT recharge_amount;
2759 char o_name[MAX_NLEN];
2761 /* Only accept legal items */
2762 item_tester_hook = item_tester_hook_recharge;
2765 q = _("どのアイテムに魔力を充填しますか? ", "Recharge which item? ");
2766 s = _("魔力を充填すべきアイテムがない。", "You have nothing to recharge.");
2768 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return (FALSE);
2770 /* Get the item (in the pack) */
2773 o_ptr = &inventory[item];
2776 /* Get the item (on the floor) */
2779 o_ptr = &o_list[0 - item];
2782 /* Get the object kind. */
2783 k_ptr = &k_info[o_ptr->k_idx];
2785 /* Extract the object "level" */
2786 lev = k_info[o_ptr->k_idx].level;
2789 /* Recharge a rod */
2790 if (o_ptr->tval == TV_ROD)
2792 /* Extract a recharge strength by comparing object level to power. */
2793 recharge_strength = ((power > lev/2) ? (power - lev/2) : 0) / 5;
2797 if (one_in_(recharge_strength))
2799 /* Activate the failure code. */
2806 /* Recharge amount */
2807 recharge_amount = (power * damroll(3, 2));
2809 /* Recharge by that amount */
2810 if (o_ptr->timeout > recharge_amount)
2811 o_ptr->timeout -= recharge_amount;
2818 /* Recharge wand/staff */
2821 /* Extract a recharge strength by comparing object level to power.
2822 * Divide up a stack of wands' charges to calculate charge penalty.
2824 if ((o_ptr->tval == TV_WAND) && (o_ptr->number > 1))
2825 recharge_strength = (100 + power - lev -
2826 (8 * o_ptr->pval / o_ptr->number)) / 15;
2828 /* All staffs, unstacked wands. */
2829 else recharge_strength = (100 + power - lev -
2830 (8 * o_ptr->pval)) / 15;
2833 if (recharge_strength < 0) recharge_strength = 0;
2836 if (one_in_(recharge_strength))
2838 /* Activate the failure code. */
2842 /* If the spell didn't backfire, recharge the wand or staff. */
2845 /* Recharge based on the standard number of charges. */
2846 recharge_amount = randint1(1 + k_ptr->pval / 2);
2848 /* Multiple wands in a stack increase recharging somewhat. */
2849 if ((o_ptr->tval == TV_WAND) && (o_ptr->number > 1))
2852 (randint1(recharge_amount * (o_ptr->number - 1))) / 2;
2853 if (recharge_amount < 1) recharge_amount = 1;
2854 if (recharge_amount > 12) recharge_amount = 12;
2857 /* But each staff in a stack gets fewer additional charges,
2858 * although always at least one.
2860 if ((o_ptr->tval == TV_STAFF) && (o_ptr->number > 1))
2862 recharge_amount /= (TIME_EFFECT)o_ptr->number;
2863 if (recharge_amount < 1) recharge_amount = 1;
2866 /* Recharge the wand or staff. */
2867 o_ptr->pval += recharge_amount;
2870 /* Hack -- we no longer "know" the item */
2871 o_ptr->ident &= ~(IDENT_KNOWN);
2873 /* Hack -- we no longer think the item is empty */
2874 o_ptr->ident &= ~(IDENT_EMPTY);
2879 /* Inflict the penalties for failing a recharge. */
2882 /* Artifacts are never destroyed. */
2883 if (object_is_fixed_artifact(o_ptr))
2885 object_desc(o_name, o_ptr, OD_NAME_ONLY);
2886 msg_format(_("魔力が逆流した!%sは完全に魔力を失った。", "The recharging backfires - %s is completely drained!"), o_name);
2888 /* Artifact rods. */
2889 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout < 10000))
2890 o_ptr->timeout = (o_ptr->timeout + 100) * 2;
2892 /* Artifact wands and staffs. */
2893 else if ((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_STAFF))
2898 /* Get the object description */
2899 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2901 /*** Determine Seriousness of Failure ***/
2903 /* Mages recharge objects more safely. */
2904 if (IS_WIZARD_CLASS() || p_ptr->pclass == CLASS_MAGIC_EATER || p_ptr->pclass == CLASS_BLUE_MAGE)
2906 /* 10% chance to blow up one rod, otherwise draining. */
2907 if (o_ptr->tval == TV_ROD)
2909 if (one_in_(10)) fail_type = 2;
2912 /* 75% chance to blow up one wand, otherwise draining. */
2913 else if (o_ptr->tval == TV_WAND)
2915 if (!one_in_(3)) fail_type = 2;
2918 /* 50% chance to blow up one staff, otherwise no effect. */
2919 else if (o_ptr->tval == TV_STAFF)
2921 if (one_in_(2)) fail_type = 2;
2926 /* All other classes get no special favors. */
2929 /* 33% chance to blow up one rod, otherwise draining. */
2930 if (o_ptr->tval == TV_ROD)
2932 if (one_in_(3)) fail_type = 2;
2935 /* 20% chance of the entire stack, else destroy one wand. */
2936 else if (o_ptr->tval == TV_WAND)
2938 if (one_in_(5)) fail_type = 3;
2941 /* Blow up one staff. */
2942 else if (o_ptr->tval == TV_STAFF)
2948 /*** Apply draining and destruction. ***/
2950 /* Drain object or stack of objects. */
2953 if (o_ptr->tval == TV_ROD)
2955 msg_print(_("魔力が逆噴射して、ロッドからさらに魔力を吸い取ってしまった!", "The recharge backfires, draining the rod further!"));
2957 if (o_ptr->timeout < 10000)
2958 o_ptr->timeout = (o_ptr->timeout + 100) * 2;
2960 else if (o_ptr->tval == TV_WAND)
2962 msg_format(_("%sは破損を免れたが、魔力が全て失われた。", "You save your %s from destruction, but all charges are lost."), o_name);
2965 /* Staffs aren't drained. */
2968 /* Destroy an object or one in a stack of objects. */
2971 if (o_ptr->number > 1)
2972 msg_format(_("乱暴な魔法のために%sが一本壊れた!", "Wild magic consumes one of your %s!"), o_name);
2974 msg_format(_("乱暴な魔法のために%sが壊れた!", "Wild magic consumes your %s!"), o_name);
2976 /* Reduce rod stack maximum timeout, drain wands. */
2977 if (o_ptr->tval == TV_ROD) o_ptr->timeout = (o_ptr->number - 1) * k_ptr->pval;
2978 if (o_ptr->tval == TV_WAND) o_ptr->pval = 0;
2980 /* Reduce and describe inventory */
2983 inven_item_increase(item, -1);
2984 inven_item_describe(item);
2985 inven_item_optimize(item);
2988 /* Reduce and describe floor item */
2991 floor_item_increase(0 - item, -1);
2992 floor_item_describe(0 - item);
2993 floor_item_optimize(0 - item);
2997 /* Destroy all members of a stack of objects. */
3000 if (o_ptr->number > 1)
3001 msg_format(_("乱暴な魔法のために%sが全て壊れた!", "Wild magic consumes all your %s!"), o_name);
3003 msg_format(_("乱暴な魔法のために%sが壊れた!", "Wild magic consumes your %s!"), o_name);
3005 /* Reduce and describe inventory */
3008 inven_item_increase(item, -999);
3009 inven_item_describe(item);
3010 inven_item_optimize(item);
3013 /* Reduce and describe floor item */
3016 floor_item_increase(0 - item, -999);
3017 floor_item_describe(0 - item);
3018 floor_item_optimize(0 - item);
3024 /* Combine / Reorder the pack (later) */
3025 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
3028 p_ptr->window |= (PW_INVEN);
3030 /* Something was done */
3038 * @return ターン消費を要する処理を行ったならばTRUEを返す
3040 bool bless_weapon(void)
3044 BIT_FLAGS flgs[TR_FLAG_SIZE];
3045 char o_name[MAX_NLEN];
3048 item_tester_no_ryoute = TRUE;
3050 /* Bless only weapons */
3051 item_tester_hook = object_is_weapon;
3054 q = _("どのアイテムを祝福しますか?", "Bless which weapon? ");
3055 s = _("祝福できる武器がありません。", "You have weapon to bless.");
3057 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR)))
3060 /* Get the item (in the pack) */
3063 o_ptr = &inventory[item];
3066 /* Get the item (on the floor) */
3069 o_ptr = &o_list[0 - item];
3074 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
3076 /* Extract the flags */
3077 object_flags(o_ptr, flgs);
3079 if (object_is_cursed(o_ptr))
3081 if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && (randint1(100) < 33)) ||
3082 have_flag(flgs, TR_ADD_L_CURSE) ||
3083 have_flag(flgs, TR_ADD_H_CURSE) ||
3084 (o_ptr->curse_flags & TRC_PERMA_CURSE))
3087 msg_format("%sを覆う黒いオーラは祝福を跳ね返した!",
3090 msg_format("The black aura on %s %s disrupts the blessing!",
3091 ((item >= 0) ? "your" : "the"), o_name);
3098 msg_format("%s から邪悪なオーラが消えた。",
3101 msg_format("A malignant aura leaves %s %s.",
3102 ((item >= 0) ? "your" : "the"), o_name);
3107 o_ptr->curse_flags = 0L;
3109 /* Hack -- Assume felt */
3110 o_ptr->ident |= (IDENT_SENSE);
3113 o_ptr->feeling = FEEL_NONE;
3115 /* Recalculate the bonuses */
3116 p_ptr->update |= (PU_BONUS);
3119 p_ptr->window |= (PW_EQUIP);
3123 * Next, we try to bless it. Artifacts have a 1/3 chance of
3124 * being blessed, otherwise, the operation simply disenchants
3125 * them, godly power negating the magic. Ok, the explanation
3126 * is silly, but otherwise priests would always bless every
3127 * artifact weapon they find. Ego weapons and normal weapons
3128 * can be blessed automatically.
3130 if (have_flag(flgs, TR_BLESSED))
3133 msg_format("%s は既に祝福されている。",
3136 msg_format("%s %s %s blessed already.",
3137 ((item >= 0) ? "Your" : "The"), o_name,
3138 ((o_ptr->number > 1) ? "were" : "was"));
3144 if (!(object_is_artifact(o_ptr) || object_is_ego(o_ptr)) || one_in_(3))
3148 msg_format("%sは輝いた!",
3151 msg_format("%s %s shine%s!",
3152 ((item >= 0) ? "Your" : "The"), o_name,
3153 ((o_ptr->number > 1) ? "" : "s"));
3156 add_flag(o_ptr->art_flags, TR_BLESSED);
3157 o_ptr->discount = 99;
3161 bool dis_happened = FALSE;
3162 msg_print(_("その武器は祝福を嫌っている!", "The weapon resists your blessing!"));
3164 /* Disenchant tohit */
3165 if (o_ptr->to_h > 0)
3168 dis_happened = TRUE;
3171 if ((o_ptr->to_h > 5) && (randint0(100) < 33)) o_ptr->to_h--;
3173 /* Disenchant todam */
3174 if (o_ptr->to_d > 0)
3177 dis_happened = TRUE;
3180 if ((o_ptr->to_d > 5) && (randint0(100) < 33)) o_ptr->to_d--;
3182 /* Disenchant toac */
3183 if (o_ptr->to_a > 0)
3186 dis_happened = TRUE;
3189 if ((o_ptr->to_a > 5) && (randint0(100) < 33)) o_ptr->to_a--;
3193 msg_print(_("周囲が凡庸な雰囲気で満ちた...", "There is a static feeling in the air..."));
3196 msg_format("%s は劣化した!",
3199 msg_format("%s %s %s disenchanted!",
3200 ((item >= 0) ? "Your" : "The"), o_name,
3201 ((o_ptr->number > 1) ? "were" : "was"));
3207 /* Recalculate bonuses */
3208 p_ptr->update |= (PU_BONUS);
3211 p_ptr->window |= (PW_EQUIP | PW_PLAYER);
3222 * @return ターン消費を要する処理を行ったならばTRUEを返す
3224 bool pulish_shield(void)
3228 u32b flgs[TR_FLAG_SIZE];
3229 char o_name[MAX_NLEN];
3232 item_tester_no_ryoute = TRUE;
3233 /* Assume enchant weapon */
3234 item_tester_tval = TV_SHIELD;
3237 q = _("どの盾を磨きますか?", "Pulish which weapon? ");
3238 s = _("磨く盾がありません。", "You have weapon to pulish.");
3240 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR)))
3243 /* Get the item (in the pack) */
3246 o_ptr = &inventory[item];
3249 /* Get the item (on the floor) */
3252 o_ptr = &o_list[0 - item];
3257 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
3259 /* Extract the flags */
3260 object_flags(o_ptr, flgs);
3262 if (o_ptr->k_idx && !object_is_artifact(o_ptr) && !object_is_ego(o_ptr) &&
3263 !object_is_cursed(o_ptr) && (o_ptr->sval != SV_MIRROR_SHIELD))
3266 msg_format("%sは輝いた!", o_name);
3268 msg_format("%s %s shine%s!",
3269 ((item >= 0) ? "Your" : "The"), o_name,
3270 ((o_ptr->number > 1) ? "" : "s"));
3272 o_ptr->name2 = EGO_REFLECTION;
3273 enchant(o_ptr, randint0(3) + 4, ENCH_TOAC);
3275 o_ptr->discount = 99;
3276 chg_virtue(V_ENCHANT, 2);
3282 if (flush_failure) flush();
3284 msg_print(_("失敗した。", "Failed."));
3285 chg_virtue(V_ENCHANT, -2);
3295 * Potions "smash open" and cause an area effect when
3296 * @param who 薬破損の主体ID(プレイヤー所持アイテムが壊れた場合0、床上のアイテムの場合モンスターID)
3299 * @param k_idx 破損した薬のアイテムID
3300 * @return 薬を浴びたモンスターが起こるならばTRUEを返す
3303 * (1) they are shattered while in the player's inventory,
3304 * due to cold (etc) attacks;
3305 * (2) they are thrown at a monster, or obstacle;
3306 * (3) they are shattered by a "cold ball" or other such spell
3307 * while lying on the floor.
3310 * who --- who caused the potion to shatter (0=player)
3311 * potions that smash on the floor are assumed to
3312 * be caused by no-one (who = 1), as are those that
3313 * shatter inside the player inventory.
3314 * (Not anymore -- I changed this; TY)
3315 * y, x --- coordinates of the potion (or player if
3316 * the potion was in her inventory);
3317 * o_ptr --- pointer to the potion object.
3320 bool potion_smash_effect(MONSTER_IDX who, POSITION y, POSITION x, KIND_OBJECT_IDX k_idx)
3327 object_kind *k_ptr = &k_info[k_idx];
3329 switch (k_ptr->sval)
3331 case SV_POTION_SALT_WATER:
3332 case SV_POTION_SLIME_MOLD:
3333 case SV_POTION_LOSE_MEMORIES:
3334 case SV_POTION_DEC_STR:
3335 case SV_POTION_DEC_INT:
3336 case SV_POTION_DEC_WIS:
3337 case SV_POTION_DEC_DEX:
3338 case SV_POTION_DEC_CON:
3339 case SV_POTION_DEC_CHR:
3340 case SV_POTION_WATER: /* perhaps a 'water' attack? */
3341 case SV_POTION_APPLE_JUICE:
3344 case SV_POTION_INFRAVISION:
3345 case SV_POTION_DETECT_INVIS:
3346 case SV_POTION_SLOW_POISON:
3347 case SV_POTION_CURE_POISON:
3348 case SV_POTION_BOLDNESS:
3349 case SV_POTION_RESIST_HEAT:
3350 case SV_POTION_RESIST_COLD:
3351 case SV_POTION_HEROISM:
3352 case SV_POTION_BESERK_STRENGTH:
3353 case SV_POTION_RES_STR:
3354 case SV_POTION_RES_INT:
3355 case SV_POTION_RES_WIS:
3356 case SV_POTION_RES_DEX:
3357 case SV_POTION_RES_CON:
3358 case SV_POTION_RES_CHR:
3359 case SV_POTION_INC_STR:
3360 case SV_POTION_INC_INT:
3361 case SV_POTION_INC_WIS:
3362 case SV_POTION_INC_DEX:
3363 case SV_POTION_INC_CON:
3364 case SV_POTION_INC_CHR:
3365 case SV_POTION_AUGMENTATION:
3366 case SV_POTION_ENLIGHTENMENT:
3367 case SV_POTION_STAR_ENLIGHTENMENT:
3368 case SV_POTION_SELF_KNOWLEDGE:
3369 case SV_POTION_EXPERIENCE:
3370 case SV_POTION_RESISTANCE:
3371 case SV_POTION_INVULNERABILITY:
3372 case SV_POTION_NEW_LIFE:
3373 /* All of the above potions have no effect when shattered */
3375 case SV_POTION_SLOWNESS:
3380 case SV_POTION_POISON:
3385 case SV_POTION_BLINDNESS:
3389 case SV_POTION_CONFUSION: /* Booze */
3393 case SV_POTION_SLEEP:
3397 case SV_POTION_RUINATION:
3398 case SV_POTION_DETONATIONS:
3400 dam = damroll(25, 25);
3403 case SV_POTION_DEATH:
3404 dt = GF_DEATH_RAY; /* !! */
3405 dam = k_ptr->level * 10;
3409 case SV_POTION_SPEED:
3412 case SV_POTION_CURE_LIGHT:
3414 dam = damroll(2, 3);
3416 case SV_POTION_CURE_SERIOUS:
3418 dam = damroll(4, 3);
3420 case SV_POTION_CURE_CRITICAL:
3421 case SV_POTION_CURING:
3423 dam = damroll(6, 3);
3425 case SV_POTION_HEALING:
3427 dam = damroll(10, 10);
3429 case SV_POTION_RESTORE_EXP:
3434 case SV_POTION_LIFE:
3436 dam = damroll(50, 50);
3439 case SV_POTION_STAR_HEALING:
3441 dam = damroll(50, 50);
3444 case SV_POTION_RESTORE_MANA: /* MANA */
3446 dam = damroll(10, 10);
3453 (void)project(who, radius, y, x, dam, dt,
3454 (PROJECT_JUMP | PROJECT_ITEM | PROJECT_KILL), -1);
3456 /* XXX those potions that explode need to become "known" */
3462 * @brief プレイヤーの全既知呪文を表示する /
3463 * Hack -- Display all known spells in a window
3466 * XXX XXX XXX Need to analyze size of the window.
3467 * XXX XXX XXX Need more color coding.
3469 void display_spell_list(void)
3474 const magic_type *s_ptr;
3482 /* They have too many spells to list */
3483 if (p_ptr->pclass == CLASS_SORCERER) return;
3484 if (p_ptr->pclass == CLASS_RED_MAGE) return;
3487 if (p_ptr->pclass == CLASS_SNIPER)
3489 display_snipe_list();
3493 /* mind.c type classes */
3494 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
3495 (p_ptr->pclass == CLASS_BERSERKER) ||
3496 (p_ptr->pclass == CLASS_NINJA) ||
3497 (p_ptr->pclass == CLASS_MIRROR_MASTER) ||
3498 (p_ptr->pclass == CLASS_FORCETRAINER))
3501 int plev = p_ptr->lev;
3507 bool use_hp = FALSE;
3512 /* Display a list of spells */
3514 put_str(_("名前", "Name"), y, x + 5);
3515 put_str(_("Lv MP 失率 効果", "Lv Mana Fail Info"), y, x + 35);
3517 switch(p_ptr->pclass)
3519 case CLASS_MINDCRAFTER: use_mind = MIND_MINDCRAFTER;break;
3520 case CLASS_FORCETRAINER: use_mind = MIND_KI;break;
3521 case CLASS_BERSERKER: use_mind = MIND_BERSERKER; use_hp = TRUE; break;
3522 case CLASS_MIRROR_MASTER: use_mind = MIND_MIRROR_MASTER; break;
3523 case CLASS_NINJA: use_mind = MIND_NINJUTSU; use_hp = TRUE; break;
3524 default: use_mind = 0;break;
3527 /* Dump the spells */
3528 for (i = 0; i < MAX_MIND_POWERS; i++)
3530 byte a = TERM_WHITE;
3532 /* Access the available spell */
3533 spell = mind_powers[use_mind].info[i];
3534 if (spell.min_lev > plev) break;
3536 /* Get the failure rate */
3537 chance = spell.fail;
3539 /* Reduce failure rate by "effective" level adjustment */
3540 chance -= 3 * (p_ptr->lev - spell.min_lev);
3542 /* Reduce failure rate by INT/WIS adjustment */
3543 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
3547 /* Not enough mana to cast */
3548 if (spell.mana_cost > p_ptr->csp)
3550 chance += 5 * (spell.mana_cost - p_ptr->csp);
3556 /* Not enough hp to cast */
3557 if (spell.mana_cost > p_ptr->chp)
3564 /* Extract the minimum failure rate */
3565 minfail = adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]];
3567 /* Minimum failure rate */
3568 if (chance < minfail) chance = minfail;
3570 /* Stunning makes spells harder */
3571 if (p_ptr->stun > 50) chance += 25;
3572 else if (p_ptr->stun) chance += 15;
3574 /* Always a 5 percent chance of working */
3575 if (chance > 95) chance = 95;
3578 mindcraft_info(comment, use_mind, i);
3580 /* Dump the spell */
3581 sprintf(psi_desc, " %c) %-30s%2d %4d %3d%%%s",
3583 spell.min_lev, spell.mana_cost, chance, comment);
3585 Term_putstr(x, y + i + 1, -1, a, psi_desc);
3590 /* Cannot read spellbooks */
3591 if (REALM_NONE == p_ptr->realm1) return;
3593 /* Normal spellcaster with books */
3596 for (j = 0; j < ((p_ptr->realm2 > REALM_NONE) ? 2 : 1); j++)
3600 /* Reset vertical */
3603 /* Vertical location */
3604 y = (j < 3) ? 0 : (m[j - 3] + 2);
3606 /* Horizontal location */
3610 for (i = 0; i < 32; i++)
3612 byte a = TERM_WHITE;
3614 /* Access the spell */
3615 if (!is_magic((j < 1) ? p_ptr->realm1 : p_ptr->realm2))
3617 s_ptr = &technic_info[((j < 1) ? p_ptr->realm1 : p_ptr->realm2) - MIN_TECHNIC][i % 32];
3621 s_ptr = &mp_ptr->info[((j < 1) ? p_ptr->realm1 : p_ptr->realm2) - 1][i % 32];
3624 strcpy(name, do_spell((j < 1) ? p_ptr->realm1 : p_ptr->realm2, i % 32, SPELL_NAME));
3627 if (s_ptr->slevel >= 99)
3630 strcpy(name, _("(判読不能)", "(illegible)"));
3638 ((p_ptr->spell_forgotten1 & (1L << i))) :
3639 ((p_ptr->spell_forgotten2 & (1L << (i % 32)))))
3646 else if (!((j < 1) ?
3647 (p_ptr->spell_learned1 & (1L << i)) :
3648 (p_ptr->spell_learned2 & (1L << (i % 32)))))
3655 else if (!((j < 1) ?
3656 (p_ptr->spell_worked1 & (1L << i)) :
3657 (p_ptr->spell_worked2 & (1L << (i % 32)))))
3663 /* Dump the spell --(-- */
3664 sprintf(out_val, "%c/%c) %-20.20s",
3665 I2A(n / 8), I2A(n % 8), name);
3670 /* Dump onto the window */
3671 Term_putstr(x, m[j], -1, a, out_val);
3681 * @brief 呪文の経験値を返す /
3682 * Returns experience of a spell
3684 * @param use_realm 魔法領域
3687 s16b experience_of_spell(int spell, int use_realm)
3689 if (p_ptr->pclass == CLASS_SORCERER) return SPELL_EXP_MASTER;
3690 else if (p_ptr->pclass == CLASS_RED_MAGE) return SPELL_EXP_SKILLED;
3691 else if (use_realm == p_ptr->realm1) return p_ptr->spell_exp[spell];
3692 else if (use_realm == p_ptr->realm2) return p_ptr->spell_exp[spell + 32];
3698 * @brief 呪文の消費MPを返す /
3699 * Modify mana consumption rate using spell exp and p_ptr->dec_mana
3700 * @param need_mana 基本消費MP
3705 int mod_need_mana(int need_mana, int spell, int realm)
3707 #define MANA_CONST 2400
3709 #define DEC_MANA_DIV 3
3712 if ((realm > REALM_NONE) && (realm <= MAX_REALM))
3715 * need_mana defaults if spell exp equals SPELL_EXP_EXPERT and !p_ptr->dec_mana.
3716 * MANA_CONST is used to calculate need_mana effected from spell proficiency.
3718 need_mana = need_mana * (MANA_CONST + SPELL_EXP_EXPERT - experience_of_spell(spell, realm)) + (MANA_CONST - 1);
3719 need_mana *= p_ptr->dec_mana ? DEC_MANA_DIV : MANA_DIV;
3720 need_mana /= MANA_CONST * MANA_DIV;
3721 if (need_mana < 1) need_mana = 1;
3724 /* Non-realm magic */
3727 if (p_ptr->dec_mana) need_mana = (need_mana + 1) * DEC_MANA_DIV / MANA_DIV;
3739 * @brief 呪文の失敗率修正処理1(呪い、消費魔力減少、呪文簡易化) /
3740 * Modify spell fail rate
3741 * Using p_ptr->to_m_chance, p_ptr->dec_mana, p_ptr->easy_spell and p_ptr->heavy_spell
3742 * @param chance 修正前失敗率
3746 PERCENTAGE mod_spell_chance_1(PERCENTAGE chance)
3748 chance += p_ptr->to_m_chance;
3750 if (p_ptr->heavy_spell) chance += 20;
3752 if (p_ptr->dec_mana && p_ptr->easy_spell) chance -= 4;
3753 else if (p_ptr->easy_spell) chance -= 3;
3754 else if (p_ptr->dec_mana) chance -= 2;
3761 * @brief 呪文の失敗率修正処理2(消費魔力減少、呪い、負値修正) /
3762 * Modify spell fail rate
3763 * Using p_ptr->to_m_chance, p_ptr->dec_mana, p_ptr->easy_spell and p_ptr->heavy_spell
3764 * @param chance 修正前失敗率
3766 * Modify spell fail rate (as "suffix" process)
3767 * Using p_ptr->dec_mana, p_ptr->easy_spell and p_ptr->heavy_spell
3768 * Note: variable "chance" cannot be negative.
3771 PERCENTAGE mod_spell_chance_2(PERCENTAGE chance)
3773 if (p_ptr->dec_mana) chance--;
3775 if (p_ptr->heavy_spell) chance += 5;
3777 return MAX(chance, 0);
3782 * @brief 呪文の失敗率計算メインルーチン /
3783 * Returns spell chance of failure for spell -RAK-
3785 * @param use_realm 魔法領域ID
3788 PERCENTAGE spell_chance(SPELL_IDX spell, REALM_IDX use_realm)
3790 PERCENTAGE chance, minfail;
3791 const magic_type *s_ptr;
3792 MANA_POINT need_mana;
3793 PERCENTAGE penalty = (mp_ptr->spell_stat == A_WIS) ? 10 : 4;
3796 /* Paranoia -- must be literate */
3797 if (!mp_ptr->spell_book) return (100);
3799 if (use_realm == REALM_HISSATSU) return 0;
3801 /* Access the spell */
3802 if (!is_magic(use_realm))
3804 s_ptr = &technic_info[use_realm - MIN_TECHNIC][spell];
3808 s_ptr = &mp_ptr->info[use_realm - 1][spell];
3811 /* Extract the base spell failure rate */
3812 chance = s_ptr->sfail;
3814 /* Reduce failure rate by "effective" level adjustment */
3815 chance -= 3 * (p_ptr->lev - s_ptr->slevel);
3817 /* Reduce failure rate by INT/WIS adjustment */
3818 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
3821 chance += (MAX(r_info[m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 100 - 10, 0));
3823 /* Extract mana consumption rate */
3824 need_mana = mod_need_mana(s_ptr->smana, spell, use_realm);
3826 /* Not enough mana to cast */
3827 if (need_mana > p_ptr->csp)
3829 chance += 5 * (need_mana - p_ptr->csp);
3832 if ((use_realm != p_ptr->realm1) && ((p_ptr->pclass == CLASS_MAGE) || (p_ptr->pclass == CLASS_PRIEST))) chance += 5;
3834 /* Extract the minimum failure rate */
3835 minfail = adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]];
3838 * Non mage/priest characters never get too good
3839 * (added high mage, mindcrafter)
3841 if (mp_ptr->spell_xtra & MAGIC_FAIL_5PERCENT)
3843 if (minfail < 5) minfail = 5;
3846 /* Hack -- Priest prayer penalty for "edged" weapons -DGK */
3847 if (((p_ptr->pclass == CLASS_PRIEST) || (p_ptr->pclass == CLASS_SORCERER)) && p_ptr->icky_wield[0]) chance += 25;
3848 if (((p_ptr->pclass == CLASS_PRIEST) || (p_ptr->pclass == CLASS_SORCERER)) && p_ptr->icky_wield[1]) chance += 25;
3850 chance = mod_spell_chance_1(chance);
3852 /* Goodness or evilness gives a penalty to failure rate */
3856 if ((p_ptr->align > 50) || (p_ptr->align < -50)) chance += penalty;
3858 case REALM_LIFE: case REALM_CRUSADE:
3859 if (p_ptr->align < -20) chance += penalty;
3861 case REALM_DEATH: case REALM_DAEMON: case REALM_HEX:
3862 if (p_ptr->align > 20) chance += penalty;
3866 /* Minimum failure rate */
3867 if (chance < minfail) chance = minfail;
3869 /* Stunning makes spells harder */
3870 if (p_ptr->stun > 50) chance += 25;
3871 else if (p_ptr->stun) chance += 15;
3873 /* Always a 5 percent chance of working */
3874 if (chance > 95) chance = 95;
3876 if ((use_realm == p_ptr->realm1) || (use_realm == p_ptr->realm2)
3877 || (p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
3879 s16b exp = experience_of_spell(spell, use_realm);
3880 if (exp >= SPELL_EXP_EXPERT) chance--;
3881 if (exp >= SPELL_EXP_MASTER) chance--;
3884 /* Return the chance */
3885 return mod_spell_chance_2(chance);
3890 * @brief 魔法が利用可能かどうかを返す /
3891 * Determine if a spell is "okay" for the player to cast or study
3892 * The spell must be legible, not forgotten, and also, to cast,
3893 * it must be known, and to study, it must not be known.
3895 * @param learned 使用可能な判定ならばTRUE、学習可能かどうかの判定ならばFALSE
3896 * @param study_pray 祈りの学習判定目的ならばTRUE
3897 * @param use_realm 魔法領域ID
3900 bool spell_okay(int spell, bool learned, bool study_pray, int use_realm)
3902 const magic_type *s_ptr;
3904 /* Access the spell */
3905 if (!is_magic(use_realm))
3907 s_ptr = &technic_info[use_realm - MIN_TECHNIC][spell];
3911 s_ptr = &mp_ptr->info[use_realm - 1][spell];
3914 /* Spell is illegal */
3915 if (s_ptr->slevel > p_ptr->lev) return (FALSE);
3917 /* Spell is forgotten */
3918 if ((use_realm == p_ptr->realm2) ?
3919 (p_ptr->spell_forgotten2 & (1L << spell)) :
3920 (p_ptr->spell_forgotten1 & (1L << spell)))
3926 if (p_ptr->pclass == CLASS_SORCERER) return (TRUE);
3927 if (p_ptr->pclass == CLASS_RED_MAGE) return (TRUE);
3929 /* Spell is learned */
3930 if ((use_realm == p_ptr->realm2) ?
3931 (p_ptr->spell_learned2 & (1L << spell)) :
3932 (p_ptr->spell_learned1 & (1L << spell)))
3935 return (!study_pray);
3938 /* Okay to study, not to cast */
3945 * @brief 呪文情報の表示処理 /
3946 * Print a list of spells (for browsing or casting or viewing)
3947 * @param target_spell 呪文ID
3948 * @param spells 表示するスペルID配列の参照ポインタ
3949 * @param num 表示するスペルの数(spellsの要素数)
3950 * @param y 表示メッセージ左上Y座標
3951 * @param x 表示メッセージ左上X座標
3952 * @param use_realm 魔法領域ID
3955 void print_spells(SPELL_IDX target_spell, SPELL_IDX *spells, int num, TERM_POSITION y, TERM_POSITION x, REALM_IDX use_realm)
3957 int i, spell, exp_level, increment = 64;
3958 const magic_type *s_ptr;
3969 if (((use_realm <= REALM_NONE) || (use_realm > MAX_REALM)) && p_ptr->wizard)
3970 msg_print(_("警告! print_spell が領域なしに呼ばれた", "Warning! print_spells called with null realm"));
3972 /* Title the list */
3974 if (use_realm == REALM_HISSATSU)
3975 strcpy(buf,_(" Lv MP", " Lv SP"));
3977 strcpy(buf,_("熟練度 Lv MP 失率 効果", "Profic Lv SP Fail Effect"));
3979 put_str(_("名前", "Name"), y, x + 5);
3980 put_str(buf, y, x + 29);
3982 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE)) increment = 0;
3983 else if (use_realm == p_ptr->realm1) increment = 0;
3984 else if (use_realm == p_ptr->realm2) increment = 32;
3986 /* Dump the spells */
3987 for (i = 0; i < num; i++)
3989 /* Access the spell */
3992 /* Access the spell */
3993 if (!is_magic(use_realm))
3995 s_ptr = &technic_info[use_realm - MIN_TECHNIC][spell];
3999 s_ptr = &mp_ptr->info[use_realm - 1][spell];
4002 if (use_realm == REALM_HISSATSU)
4003 need_mana = s_ptr->smana;
4006 s16b exp = experience_of_spell(spell, use_realm);
4008 /* Extract mana consumption rate */
4009 need_mana = mod_need_mana(s_ptr->smana, spell, use_realm);
4011 if ((increment == 64) || (s_ptr->slevel >= 99)) exp_level = EXP_LEVEL_UNSKILLED;
4012 else exp_level = spell_exp_level(exp);
4015 if (!increment && (exp_level == EXP_LEVEL_MASTER)) max = TRUE;
4016 else if ((increment == 32) && (exp_level >= EXP_LEVEL_EXPERT)) max = TRUE;
4017 else if (s_ptr->slevel >= 99) max = TRUE;
4018 else if ((p_ptr->pclass == CLASS_RED_MAGE) && (exp_level >= EXP_LEVEL_SKILLED)) max = TRUE;
4020 strncpy(ryakuji, exp_level_str[exp_level], 4);
4025 if (use_menu && target_spell)
4027 if (i == (target_spell-1))
4028 strcpy(out_val, _(" 》 ", " > "));
4030 strcpy(out_val, " ");
4032 else sprintf(out_val, " %c) ", I2A(i));
4033 /* Skip illegible spells */
4034 if (s_ptr->slevel >= 99)
4036 strcat(out_val, format("%-30s", _("(判読不能)", "(illegible)")));
4037 c_prt(TERM_L_DARK, out_val, y + i + 1, x);
4041 /* XXX XXX Could label spells above the players level */
4043 /* Get extra info */
4044 strcpy(info, do_spell(use_realm, spell, SPELL_INFO));
4049 /* Assume spell is known and tried */
4050 line_attr = TERM_WHITE;
4052 /* Analyze the spell */
4053 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4055 if (s_ptr->slevel > p_ptr->max_plv)
4057 comment = _("未知", "unknown");
4058 line_attr = TERM_L_BLUE;
4060 else if (s_ptr->slevel > p_ptr->lev)
4062 comment = _("忘却", "forgotten");
4063 line_attr = TERM_YELLOW;
4066 else if ((use_realm != p_ptr->realm1) && (use_realm != p_ptr->realm2))
4068 comment = _("未知", "unknown");
4069 line_attr = TERM_L_BLUE;
4071 else if ((use_realm == p_ptr->realm1) ?
4072 ((p_ptr->spell_forgotten1 & (1L << spell))) :
4073 ((p_ptr->spell_forgotten2 & (1L << spell))))
4075 comment = _("忘却", "forgotten");
4076 line_attr = TERM_YELLOW;
4078 else if (!((use_realm == p_ptr->realm1) ?
4079 (p_ptr->spell_learned1 & (1L << spell)) :
4080 (p_ptr->spell_learned2 & (1L << spell))))
4082 comment = _("未知", "unknown");
4083 line_attr = TERM_L_BLUE;
4085 else if (!((use_realm == p_ptr->realm1) ?
4086 (p_ptr->spell_worked1 & (1L << spell)) :
4087 (p_ptr->spell_worked2 & (1L << spell))))
4089 comment = _("未経験", "untried");
4090 line_attr = TERM_L_GREEN;
4093 /* Dump the spell --(-- */
4094 if (use_realm == REALM_HISSATSU)
4096 strcat(out_val, format("%-25s %2d %4d",
4097 do_spell(use_realm, spell, SPELL_NAME), /* realm, spell */
4098 s_ptr->slevel, need_mana));
4102 strcat(out_val, format("%-25s%c%-4s %2d %4d %3d%% %s",
4103 do_spell(use_realm, spell, SPELL_NAME), /* realm, spell */
4104 (max ? '!' : ' '), ryakuji,
4105 s_ptr->slevel, need_mana, spell_chance(spell, use_realm), comment));
4107 c_prt(line_attr, out_val, y + i + 1, x);
4110 /* Clear the bottom line */
4111 prt("", y + i + 1, x);
4116 * @brief アイテムが酸で破損するかどうかを判定する
4117 * @param o_ptr アイテムの情報参照ポインタ
4118 * @return 破損するならばTRUEを返す
4119 * Note that amulets, rods, and high-level spell books are immune
4120 * to "inventory damage" of any kind. Also sling ammo and shovels.
4121 * Does a given class of objects (usually) hate acid?
4122 * Note that acid can either melt or corrode something.
4124 bool hates_acid(object_type *o_ptr)
4126 /* Analyze the type */
4127 switch (o_ptr->tval)
4129 /* Wearable items */
4149 /* Staffs/Scrolls are wood/paper */
4162 /* Junk is useless */
4176 * @brief アイテムが電撃で破損するかどうかを判定する /
4177 * Does a given object (usually) hate electricity?
4178 * @param o_ptr アイテムの情報参照ポインタ
4179 * @return 破損するならばTRUEを返す
4181 bool hates_elec(object_type *o_ptr)
4183 switch (o_ptr->tval)
4197 * @brief アイテムが火炎で破損するかどうかを判定する /
4198 * Does a given object (usually) hate fire?
4199 * @param o_ptr アイテムの情報参照ポインタ
4200 * @return 破損するならばTRUEを返す
4202 * Hafted/Polearm weapons have wooden shafts.
4203 * Arrows/Bows are mostly wooden.
4205 bool hates_fire(object_type *o_ptr)
4207 /* Analyze the type */
4208 switch (o_ptr->tval)
4226 case TV_SORCERY_BOOK:
4227 case TV_NATURE_BOOK:
4231 case TV_ARCANE_BOOK:
4233 case TV_DAEMON_BOOK:
4234 case TV_CRUSADE_BOOK:
4236 case TV_HISSATSU_BOOK:
4248 /* Staffs/Scrolls burn */
4261 * @brief アイテムが冷気で破損するかどうかを判定する /
4262 * Does a given object (usually) hate cold?
4263 * @param o_ptr アイテムの情報参照ポインタ
4264 * @return 破損するならばTRUEを返す
4266 bool hates_cold(object_type *o_ptr)
4268 switch (o_ptr->tval)
4283 * @brief アイテムが酸で破損するかどうかを判定する(メインルーチン) /
4285 * @param o_ptr アイテムの情報参照ポインタ
4286 * @return 破損するならばTRUEを返す
4289 int set_acid_destroy(object_type *o_ptr)
4291 u32b flgs[TR_FLAG_SIZE];
4292 if (!hates_acid(o_ptr)) return (FALSE);
4293 object_flags(o_ptr, flgs);
4294 if (have_flag(flgs, TR_IGNORE_ACID)) return (FALSE);
4300 * @brief アイテムが電撃で破損するかどうかを判定する(メインルーチン) /
4302 * @param o_ptr アイテムの情報参照ポインタ
4303 * @return 破損するならばTRUEを返す
4306 int set_elec_destroy(object_type *o_ptr)
4308 u32b flgs[TR_FLAG_SIZE];
4309 if (!hates_elec(o_ptr)) return (FALSE);
4310 object_flags(o_ptr, flgs);
4311 if (have_flag(flgs, TR_IGNORE_ELEC)) return (FALSE);
4317 * @brief アイテムが火炎で破損するかどうかを判定する(メインルーチン) /
4319 * @param o_ptr アイテムの情報参照ポインタ
4320 * @return 破損するならばTRUEを返す
4323 int set_fire_destroy(object_type *o_ptr)
4325 u32b flgs[TR_FLAG_SIZE];
4326 if (!hates_fire(o_ptr)) return (FALSE);
4327 object_flags(o_ptr, flgs);
4328 if (have_flag(flgs, TR_IGNORE_FIRE)) return (FALSE);
4334 * @brief アイテムが冷気で破損するかどうかを判定する(メインルーチン) /
4336 * @param o_ptr アイテムの情報参照ポインタ
4337 * @return 破損するならばTRUEを返す
4340 int set_cold_destroy(object_type *o_ptr)
4342 u32b flgs[TR_FLAG_SIZE];
4343 if (!hates_cold(o_ptr)) return (FALSE);
4344 object_flags(o_ptr, flgs);
4345 if (have_flag(flgs, TR_IGNORE_COLD)) return (FALSE);
4351 * @brief アイテムが指定確率で破損するかどうかを判定する /
4352 * Destroys a type of item on a given percent chance
4353 * @param typ 破損判定関数ポインタ
4355 * @return 破損したアイテムの数
4357 * Note that missiles are no longer necessarily all destroyed
4358 * Destruction taken from "melee.c" code for "stealing".
4359 * New-style wands and rods handled correctly. -LM-
4360 * Returns number of items destroyed.
4362 int inven_damage(inven_func typ, int perc)
4366 char o_name[MAX_NLEN];
4368 if (CHECK_MULTISHADOW()) return 0;
4370 if (p_ptr->inside_arena) return 0;
4372 /* Count the casualties */
4375 /* Scan through the slots backwards */
4376 for (i = 0; i < INVEN_PACK; i++)
4378 o_ptr = &inventory[i];
4380 /* Skip non-objects */
4381 if (!o_ptr->k_idx) continue;
4383 /* Hack -- for now, skip artifacts */
4384 if (object_is_artifact(o_ptr)) continue;
4386 /* Give this item slot a shot at death */
4389 /* Count the casualties */
4390 for (amt = j = 0; j < o_ptr->number; ++j)
4392 if (randint0(100) < perc) amt++;
4395 /* Some casualities */
4398 /* Get a description */
4399 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
4402 msg_format(_("%s(%c)が%s壊れてしまった!", "%sour %s (%c) %s destroyed!"),
4405 o_name, index_to_label(i),
4406 ((o_ptr->number > 1) ?
4407 ((amt == o_ptr->number) ? "全部" :
4408 (amt > 1 ? "何個か" : "一個")) : "") );
4410 ((o_ptr->number > 1) ?
4411 ((amt == o_ptr->number) ? "All of y" :
4412 (amt > 1 ? "Some of y" : "One of y")) : "Y"),
4413 o_name, index_to_label(i),
4414 ((amt > 1) ? "were" : "was"));
4418 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
4419 msg_print("やりやがったな!");
4422 /* Potions smash open */
4423 if (object_is_potion(o_ptr))
4425 (void)potion_smash_effect(0, p_ptr->y, p_ptr->x, o_ptr->k_idx);
4428 /* Reduce the charges of rods/wands */
4429 reduce_charges(o_ptr, amt);
4431 /* Destroy "amt" items */
4432 inven_item_increase(i, -amt);
4433 inven_item_optimize(i);
4435 /* Count the casualties */
4441 /* Return the casualty count */
4447 * @brief 酸攻撃による装備のAC劣化処理 /
4448 * Acid has hit the player, attempt to affect some armor.
4449 * @return ACが実際に劣化したらTRUEを返す
4451 * Note that the "base armor" of an object never changes.
4452 * If any armor is damaged (or resists), the player takes less damage.
4454 static int minus_ac(void)
4456 object_type *o_ptr = NULL;
4457 u32b flgs[TR_FLAG_SIZE];
4458 char o_name[MAX_NLEN];
4461 /* Pick a (possibly empty) inventory slot */
4462 switch (randint1(7))
4464 case 1: o_ptr = &inventory[INVEN_RARM]; break;
4465 case 2: o_ptr = &inventory[INVEN_LARM]; break;
4466 case 3: o_ptr = &inventory[INVEN_BODY]; break;
4467 case 4: o_ptr = &inventory[INVEN_OUTER]; break;
4468 case 5: o_ptr = &inventory[INVEN_HANDS]; break;
4469 case 6: o_ptr = &inventory[INVEN_HEAD]; break;
4470 case 7: o_ptr = &inventory[INVEN_FEET]; break;
4473 /* Nothing to damage */
4474 if (!o_ptr->k_idx) return (FALSE);
4476 if (!object_is_armour(o_ptr)) return (FALSE);
4478 /* No damage left to be done */
4479 if (o_ptr->ac + o_ptr->to_a <= 0) return (FALSE);
4483 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
4485 /* Extract the flags */
4486 object_flags(o_ptr, flgs);
4488 /* Object resists */
4489 if (have_flag(flgs, TR_IGNORE_ACID))
4491 msg_format(_("しかし%sには効果がなかった!", "Your %s is unaffected!"), o_name);
4496 msg_format(_("%sがダメージを受けた!", "Your %s is damaged!"), o_name);
4498 /* Damage the item */
4501 /* Calculate bonuses */
4502 p_ptr->update |= (PU_BONUS);
4505 p_ptr->window |= (PW_EQUIP | PW_PLAYER);
4509 /* Item was damaged */
4515 * @brief 酸属性によるプレイヤー損害処理 /
4516 * Hurt the player with Acid
4517 * @param dam 基本ダメージ量
4518 * @param kb_str ダメージ原因記述
4519 * @param monspell 原因となったモンスター特殊攻撃ID
4520 * @param aura オーラよるダメージが原因ならばTRUE
4523 int acid_dam(HIT_POINT dam, cptr kb_str, int monspell, bool aura)
4526 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
4527 bool double_resist = IS_OPPOSE_ACID();
4529 /* Total Immunity */
4530 if (p_ptr->immune_acid || (dam <= 0))
4532 learn_spell(monspell);
4536 /* Vulnerability (Ouch!) */
4537 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
4538 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
4540 /* Resist the damage */
4541 if (p_ptr->resist_acid) dam = (dam + 2) / 3;
4542 if (double_resist) dam = (dam + 2) / 3;
4544 if (aura || !CHECK_MULTISHADOW())
4546 if ((!(double_resist || p_ptr->resist_acid)) &&
4547 one_in_(HURT_CHANCE))
4548 (void)do_dec_stat(A_CHR);
4550 /* If any armor gets hit, defend the player */
4551 if (minus_ac()) dam = (dam + 1) / 2;
4555 get_damage = take_hit(aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell);
4557 /* Inventory damage */
4558 if (!aura && !(double_resist && p_ptr->resist_acid))
4559 inven_damage(set_acid_destroy, inv);
4565 * @brief 電撃属性によるプレイヤー損害処理 /
4566 * Hurt the player with electricity
4567 * @param dam 基本ダメージ量
4568 * @param kb_str ダメージ原因記述
4569 * @param monspell 原因となったモンスター特殊攻撃ID
4570 * @param aura オーラよるダメージが原因ならばTRUE
4573 int elec_dam(HIT_POINT dam, cptr kb_str, int monspell, bool aura)
4576 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
4577 bool double_resist = IS_OPPOSE_ELEC();
4579 /* Total immunity */
4580 if (p_ptr->immune_elec || (dam <= 0))
4582 learn_spell(monspell);
4586 /* Vulnerability (Ouch!) */
4587 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
4588 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
4589 if (prace_is_(RACE_ANDROID)) dam += dam / 3;
4591 /* Resist the damage */
4592 if (p_ptr->resist_elec) dam = (dam + 2) / 3;
4593 if (double_resist) dam = (dam + 2) / 3;
4595 if (aura || !CHECK_MULTISHADOW())
4597 if ((!(double_resist || p_ptr->resist_elec)) &&
4598 one_in_(HURT_CHANCE))
4599 (void)do_dec_stat(A_DEX);
4603 get_damage = take_hit(aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell);
4605 /* Inventory damage */
4606 if (!aura && !(double_resist && p_ptr->resist_elec))
4607 inven_damage(set_elec_destroy, inv);
4614 * @brief 火炎属性によるプレイヤー損害処理 /
4615 * Hurt the player with Fire
4616 * @param dam 基本ダメージ量
4617 * @param kb_str ダメージ原因記述
4618 * @param monspell 原因となったモンスター特殊攻撃ID
4619 * @param aura オーラよるダメージが原因ならばTRUE
4622 int fire_dam(HIT_POINT dam, cptr kb_str, int monspell, bool aura)
4625 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
4626 bool double_resist = IS_OPPOSE_FIRE();
4628 /* Totally immune */
4629 if (p_ptr->immune_fire || (dam <= 0))
4631 learn_spell(monspell);
4635 /* Vulnerability (Ouch!) */
4636 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
4637 if (prace_is_(RACE_ENT)) dam += dam / 3;
4638 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
4640 /* Resist the damage */
4641 if (p_ptr->resist_fire) dam = (dam + 2) / 3;
4642 if (double_resist) dam = (dam + 2) / 3;
4644 if (aura || !CHECK_MULTISHADOW())
4646 if ((!(double_resist || p_ptr->resist_fire)) &&
4647 one_in_(HURT_CHANCE))
4648 (void)do_dec_stat(A_STR);
4652 get_damage = take_hit(aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell);
4654 /* Inventory damage */
4655 if (!aura && !(double_resist && p_ptr->resist_fire))
4656 inven_damage(set_fire_destroy, inv);
4663 * @brief 冷気属性によるプレイヤー損害処理 /
4664 * Hurt the player with Cold
4665 * @param dam 基本ダメージ量
4666 * @param kb_str ダメージ原因記述
4667 * @param monspell 原因となったモンスター特殊攻撃ID
4668 * @param aura オーラよるダメージが原因ならばTRUE
4671 int cold_dam(HIT_POINT dam, cptr kb_str, int monspell, bool aura)
4674 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
4675 bool double_resist = IS_OPPOSE_COLD();
4677 /* Total immunity */
4678 if (p_ptr->immune_cold || (dam <= 0))
4680 learn_spell(monspell);
4684 /* Vulnerability (Ouch!) */
4685 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
4686 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
4688 /* Resist the damage */
4689 if (p_ptr->resist_cold) dam = (dam + 2) / 3;
4690 if (double_resist) dam = (dam + 2) / 3;
4692 if (aura || !CHECK_MULTISHADOW())
4694 if ((!(double_resist || p_ptr->resist_cold)) &&
4695 one_in_(HURT_CHANCE))
4696 (void)do_dec_stat(A_STR);
4700 get_damage = take_hit(aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell);
4702 /* Inventory damage */
4703 if (!aura && !(double_resist && p_ptr->resist_cold))
4704 inven_damage(set_cold_destroy, inv);
4711 * @return ターン消費を要する処理を行ったならばTRUEを返す
4713 bool rustproof(void)
4717 char o_name[MAX_NLEN];
4720 item_tester_no_ryoute = TRUE;
4721 /* Select a piece of armour */
4722 item_tester_hook = object_is_armour;
4725 q = _("どの防具に錆止めをしますか?", "Rustproof which piece of armour? ");
4726 s = _("錆止めできるものがありません。", "You have nothing to rustproof.");
4728 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return FALSE;
4730 /* Get the item (in the pack) */
4733 o_ptr = &inventory[item];
4736 /* Get the item (on the floor) */
4739 o_ptr = &o_list[0 - item];
4744 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
4746 add_flag(o_ptr->art_flags, TR_IGNORE_ACID);
4748 if ((o_ptr->to_a < 0) && !object_is_cursed(o_ptr))
4751 msg_format("%sは新品同様になった!",o_name);
4753 msg_format("%s %s look%s as good as new!",
4754 ((item >= 0) ? "Your" : "The"), o_name,
4755 ((o_ptr->number > 1) ? "" : "s"));
4762 msg_format("%sは腐食しなくなった。", o_name);
4764 msg_format("%s %s %s now protected against corrosion.",
4765 ((item >= 0) ? "Your" : "The"), o_name,
4766 ((o_ptr->number > 1) ? "are" : "is"));
4778 * Curse the players armor
4779 * @return 実際に呪縛されたらTRUEを返す
4781 bool curse_armor(void)
4786 char o_name[MAX_NLEN];
4789 /* Curse the body armor */
4790 o_ptr = &inventory[INVEN_BODY];
4792 /* Nothing to curse */
4793 if (!o_ptr->k_idx) return (FALSE);
4797 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
4799 /* Attempt a saving throw for artifacts */
4800 if (object_is_artifact(o_ptr) && (randint0(100) < 50))
4804 msg_format("%sが%sを包み込もうとしたが、%sはそれを跳ね返した!",
4805 "恐怖の暗黒オーラ", "防具", o_name);
4807 msg_format("A %s tries to %s, but your %s resists the effects!",
4808 "terrible black aura", "surround your armor", o_name);
4813 /* not artifact or failed save... */
4817 msg_format(_("恐怖の暗黒オーラがあなたの%sを包み込んだ!", "A terrible black aura blasts your %s!"), o_name);
4818 chg_virtue(V_ENCHANT, -5);
4820 /* Blast the armor */
4822 o_ptr->name2 = EGO_BLASTED;
4823 o_ptr->to_a = 0 - randint1(5) - randint1(5);
4830 for (i = 0; i < TR_FLAG_SIZE; i++)
4831 o_ptr->art_flags[i] = 0;
4834 o_ptr->curse_flags = TRC_CURSED;
4837 o_ptr->ident |= (IDENT_BROKEN);
4839 /* Recalculate bonuses */
4840 p_ptr->update |= (PU_BONUS);
4842 /* Recalculate mana */
4843 p_ptr->update |= (PU_MANA);
4846 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
4854 * Curse the players weapon
4855 * @param force 無条件に呪縛を行うならばTRUE
4856 * @param o_ptr 呪縛する武器のアイテム情報参照ポインタ
4857 * @return 実際に呪縛されたらTRUEを返す
4859 bool curse_weapon_object(bool force, object_type *o_ptr)
4862 char o_name[MAX_NLEN];
4864 /* Nothing to curse */
4865 if (!o_ptr->k_idx) return (FALSE);
4868 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
4870 /* Attempt a saving throw */
4871 if (object_is_artifact(o_ptr) && (randint0(100) < 50) && !force)
4875 msg_format("%sが%sを包み込もうとしたが、%sはそれを跳ね返した!",
4876 "恐怖の暗黒オーラ", "武器", o_name);
4878 msg_format("A %s tries to %s, but your %s resists the effects!",
4879 "terrible black aura", "surround your weapon", o_name);
4883 /* not artifact or failed save... */
4887 if (!force) msg_format(_("恐怖の暗黒オーラがあなたの%sを包み込んだ!", "A terrible black aura blasts your %s!"), o_name);
4888 chg_virtue(V_ENCHANT, -5);
4890 /* Shatter the weapon */
4892 o_ptr->name2 = EGO_SHATTERED;
4893 o_ptr->to_h = 0 - randint1(5) - randint1(5);
4894 o_ptr->to_d = 0 - randint1(5) - randint1(5);
4900 for (i = 0; i < TR_FLAG_SIZE; i++)
4901 o_ptr->art_flags[i] = 0;
4904 o_ptr->curse_flags = TRC_CURSED;
4907 o_ptr->ident |= (IDENT_BROKEN);
4909 /* Recalculate bonuses */
4910 p_ptr->update |= (PU_BONUS);
4912 /* Recalculate mana */
4913 p_ptr->update |= (PU_MANA);
4916 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
4924 * @brief 武器呪縛処理のメインルーチン /
4925 * Curse the players weapon
4926 * @param force 無条件に呪縛を行うならばTRUE
4927 * @param slot 呪縛する武器の装備スロット
4928 * @return 実際に呪縛されたらTRUEを返す
4930 bool curse_weapon(bool force, int slot)
4932 /* Curse the weapon */
4933 return curse_weapon_object(force, &inventory[slot]);
4938 * @brief ボルトのエゴ化処理(火炎エゴのみ) /
4939 * Enchant some bolts
4942 bool brand_bolts(void)
4946 /* Use the first acceptable bolts */
4947 for (i = 0; i < INVEN_PACK; i++)
4949 object_type *o_ptr = &inventory[i];
4951 /* Skip non-bolts */
4952 if (o_ptr->tval != TV_BOLT) continue;
4954 /* Skip artifacts and ego-items */
4955 if (object_is_artifact(o_ptr) || object_is_ego(o_ptr))
4958 /* Skip cursed/broken items */
4959 if (object_is_cursed(o_ptr) || object_is_broken(o_ptr)) continue;
4962 if (randint0(100) < 75) continue;
4965 msg_print(_("クロスボウの矢が炎のオーラに包まれた!", "Your bolts are covered in a fiery aura!"));
4968 o_ptr->name2 = EGO_FLAME;
4971 enchant(o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
4978 if (flush_failure) flush();
4981 msg_print(_("炎で強化するのに失敗した。", "The fiery enchantment failed."));
4989 * @brief 変身処理向けにモンスターの近隣レベル帯モンスターを返す /
4990 * Helper function -- return a "nearby" race for polymorphing
4991 * @param r_idx 基準となるモンスター種族ID
4992 * @return 変更先のモンスター種族ID
4994 * Note that this function is one of the more "dangerous" ones...
4996 static IDX poly_r_idx(MONRACE_IDX r_idx)
4998 monster_race *r_ptr = &r_info[r_idx];
5004 /* Hack -- Uniques/Questors never polymorph */
5005 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5006 (r_ptr->flags1 & RF1_QUESTOR))
5009 /* Allowable range of "levels" for resulting monster */
5010 lev1 = r_ptr->level - ((randint1(20) / randint1(9)) + 1);
5011 lev2 = r_ptr->level + ((randint1(20) / randint1(9)) + 1);
5013 /* Pick a (possibly new) non-unique race */
5014 for (i = 0; i < 1000; i++)
5016 /* Pick a new race, using a level calculation */
5017 r = get_mon_num((dun_level + r_ptr->level) / 2 + 5);
5019 /* Handle failure */
5025 /* Ignore unique monsters */
5026 if (r_ptr->flags1 & RF1_UNIQUE) continue;
5028 /* Ignore monsters with incompatible levels */
5029 if ((r_ptr->level < lev1) || (r_ptr->level > lev2)) continue;
5031 /* Use that index */
5043 * @brief 指定座標にいるモンスターを変身させる /
5044 * Helper function -- return a "nearby" race for polymorphing
5047 * @return 実際に変身したらTRUEを返す
5049 bool polymorph_monster(POSITION y, POSITION x)
5051 cave_type *c_ptr = &cave[y][x];
5052 monster_type *m_ptr = &m_list[c_ptr->m_idx];
5053 bool polymorphed = FALSE;
5054 MONRACE_IDX new_r_idx;
5055 MONRACE_IDX old_r_idx = m_ptr->r_idx;
5056 bool targeted = (target_who == c_ptr->m_idx) ? TRUE : FALSE;
5057 bool health_tracked = (p_ptr->health_who == c_ptr->m_idx) ? TRUE : FALSE;
5058 monster_type back_m;
5060 if (p_ptr->inside_arena || p_ptr->inside_battle) return (FALSE);
5062 if ((p_ptr->riding == c_ptr->m_idx) || (m_ptr->mflag2 & MFLAG2_KAGE)) return (FALSE);
5064 /* Memorize the monster before polymorphing */
5067 /* Pick a "new" monster race */
5068 new_r_idx = poly_r_idx(old_r_idx);
5070 /* Handle polymorph */
5071 if (new_r_idx != old_r_idx)
5073 BIT_FLAGS mode = 0L;
5074 bool preserve_hold_objects = back_m.hold_o_idx ? TRUE : FALSE;
5075 s16b this_o_idx, next_o_idx = 0;
5077 /* Get the monsters attitude */
5078 if (is_friendly(m_ptr)) mode |= PM_FORCE_FRIENDLY;
5079 if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
5080 if (m_ptr->mflag2 & MFLAG2_NOPET) mode |= PM_NO_PET;
5082 /* Mega-hack -- ignore held objects */
5083 m_ptr->hold_o_idx = 0;
5085 /* "Kill" the "old" monster */
5086 delete_monster_idx(c_ptr->m_idx);
5088 /* Create a new monster (no groups) */
5089 if (place_monster_aux(0, y, x, new_r_idx, mode))
5091 m_list[hack_m_idx_ii].nickname = back_m.nickname;
5092 m_list[hack_m_idx_ii].parent_m_idx = back_m.parent_m_idx;
5093 m_list[hack_m_idx_ii].hold_o_idx = back_m.hold_o_idx;
5100 /* Placing the new monster failed */
5101 if (place_monster_aux(0, y, x, old_r_idx, (mode | PM_NO_KAGE | PM_IGNORE_TERRAIN)))
5103 m_list[hack_m_idx_ii] = back_m;
5105 /* Re-initialize monster process */
5108 else preserve_hold_objects = FALSE;
5111 /* Mega-hack -- preserve held objects */
5112 if (preserve_hold_objects)
5114 for (this_o_idx = back_m.hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
5116 /* Acquire object */
5117 object_type *o_ptr = &o_list[this_o_idx];
5119 /* Acquire next object */
5120 next_o_idx = o_ptr->next_o_idx;
5122 /* Held by new monster */
5123 o_ptr->held_m_idx = hack_m_idx_ii;
5126 else if (back_m.hold_o_idx) /* Failed (paranoia) */
5128 /* Delete objects */
5129 for (this_o_idx = back_m.hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
5131 /* Acquire next object */
5132 next_o_idx = o_list[this_o_idx].next_o_idx;
5134 /* Delete the object */
5135 delete_object_idx(this_o_idx);
5139 if (targeted) target_who = hack_m_idx_ii;
5140 if (health_tracked) health_track(hack_m_idx_ii);
5149 * @param x テレポート先のX座標
5150 * @param y テレポート先のY座標
5151 * @return 目標に指定通りテレポートできたならばTRUEを返す
5153 static bool dimension_door_aux(DEPTH x, DEPTH y)
5155 PLAYER_LEVEL plev = p_ptr->lev;
5157 p_ptr->energy_need += (s16b)((s32b)(60 - plev) * ENERGY_NEED() / 100L);
5159 if (!cave_player_teleportable_bold(y, x, 0L) ||
5160 (distance(y, x, p_ptr->y, p_ptr->x) > plev / 2 + 10) ||
5161 (!randint0(plev / 10 + 10)))
5163 p_ptr->energy_need += (s16b)((s32b)(60 - plev) * ENERGY_NEED() / 100L);
5164 teleport_player((plev + 2) * 2, TELEPORT_PASSIVE);
5171 teleport_player_to(y, x, 0L);
5180 * @brief 次元の扉処理のメインルーチン /
5182 * @return ターンを消費した場合TRUEを返す
5184 bool dimension_door(void)
5188 /* Rerutn FALSE if cancelled */
5189 if (!tgt_pt(&x, &y)) return FALSE;
5191 if (dimension_door_aux(x, y)) return TRUE;
5193 msg_print(_("精霊界から物質界に戻る時うまくいかなかった!", "You fail to exit the astral plane correctly!"));
5200 * @brief 鏡抜け処理のメインルーチン /
5201 * Mirror Master's Dimension Door
5202 * @return ターンを消費した場合TRUEを返す
5204 bool mirror_tunnel(void)
5206 POSITION x = 0, y = 0;
5208 /* Rerutn FALSE if cancelled */
5209 if (!tgt_pt(&x, &y)) return FALSE;
5211 if (dimension_door_aux(x, y)) return TRUE;
5213 msg_print(_("鏡の世界をうまく通れなかった!", "You fail to pass the mirror plane correctly!"));
5221 * @return ターンを消費した場合TRUEを返す
5223 bool eat_magic(int power)
5225 object_type * o_ptr;
5229 int recharge_strength = 0;
5235 char o_name[MAX_NLEN];
5237 item_tester_hook = item_tester_hook_recharge;
5240 q = _("どのアイテムから魔力を吸収しますか?", "Drain which item? ");
5241 s = _("魔力を吸収できるアイテムがありません。", "You have nothing to drain.");
5243 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return FALSE;
5247 o_ptr = &inventory[item];
5251 o_ptr = &o_list[0 - item];
5254 k_ptr = &k_info[o_ptr->k_idx];
5255 lev = k_info[o_ptr->k_idx].level;
5257 if (o_ptr->tval == TV_ROD)
5259 recharge_strength = ((power > lev/2) ? (power - lev/2) : 0) / 5;
5262 if (one_in_(recharge_strength))
5264 /* Activate the failure code. */
5269 if (o_ptr->timeout > (o_ptr->number - 1) * k_ptr->pval)
5271 msg_print(_("充填中のロッドから魔力を吸収することはできません。", "You can't absorb energy from a discharged rod."));
5276 o_ptr->timeout += k_ptr->pval;
5282 /* All staffs, wands. */
5283 recharge_strength = (100 + power - lev) / 15;
5286 if (recharge_strength < 0) recharge_strength = 0;
5289 if (one_in_(recharge_strength))
5291 /* Activate the failure code. */
5296 if (o_ptr->pval > 0)
5298 p_ptr->csp += lev / 2;
5301 /* XXX Hack -- unstack if necessary */
5302 if ((o_ptr->tval == TV_STAFF) && (item >= 0) && (o_ptr->number > 1))
5307 /* Get local object */
5310 /* Obtain a local object */
5311 object_copy(q_ptr, o_ptr);
5313 /* Modify quantity */
5316 /* Restore the charges */
5319 /* Unstack the used item */
5321 p_ptr->total_weight -= q_ptr->weight;
5322 item = inven_carry(q_ptr);
5325 msg_print(_("杖をまとめなおした。", "You unstack your staff."));
5330 msg_print(_("吸収できる魔力がありません!", "There's no energy there to absorb!"));
5332 if (!o_ptr->pval) o_ptr->ident |= IDENT_EMPTY;
5336 /* Inflict the penalties for failing a recharge. */
5339 /* Artifacts are never destroyed. */
5340 if (object_is_fixed_artifact(o_ptr))
5342 object_desc(o_name, o_ptr, OD_NAME_ONLY);
5343 msg_format(_("魔力が逆流した!%sは完全に魔力を失った。", "The recharging backfires - %s is completely drained!"), o_name);
5345 /* Artifact rods. */
5346 if (o_ptr->tval == TV_ROD)
5347 o_ptr->timeout = k_ptr->pval * o_ptr->number;
5349 /* Artifact wands and staffs. */
5350 else if ((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_STAFF))
5355 /* Get the object description */
5356 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
5358 /*** Determine Seriousness of Failure ***/
5360 /* Mages recharge objects more safely. */
5361 if (IS_WIZARD_CLASS())
5363 /* 10% chance to blow up one rod, otherwise draining. */
5364 if (o_ptr->tval == TV_ROD)
5366 if (one_in_(10)) fail_type = 2;
5369 /* 75% chance to blow up one wand, otherwise draining. */
5370 else if (o_ptr->tval == TV_WAND)
5372 if (!one_in_(3)) fail_type = 2;
5375 /* 50% chance to blow up one staff, otherwise no effect. */
5376 else if (o_ptr->tval == TV_STAFF)
5378 if (one_in_(2)) fail_type = 2;
5383 /* All other classes get no special favors. */
5386 /* 33% chance to blow up one rod, otherwise draining. */
5387 if (o_ptr->tval == TV_ROD)
5389 if (one_in_(3)) fail_type = 2;
5392 /* 20% chance of the entire stack, else destroy one wand. */
5393 else if (o_ptr->tval == TV_WAND)
5395 if (one_in_(5)) fail_type = 3;
5398 /* Blow up one staff. */
5399 else if (o_ptr->tval == TV_STAFF)
5405 /*** Apply draining and destruction. ***/
5407 /* Drain object or stack of objects. */
5410 if (o_ptr->tval == TV_ROD)
5412 msg_format(_("ロッドは破損を免れたが、魔力は全て失なわれた。",
5413 "You save your rod from destruction, but all charges are lost."), o_name);
5414 o_ptr->timeout = k_ptr->pval * o_ptr->number;
5416 else if (o_ptr->tval == TV_WAND)
5418 msg_format(_("%sは破損を免れたが、魔力が全て失われた。", "You save your %s from destruction, but all charges are lost."), o_name);
5421 /* Staffs aren't drained. */
5424 /* Destroy an object or one in a stack of objects. */
5427 if (o_ptr->number > 1)
5429 msg_format(_("乱暴な魔法のために%sが一本壊れた!", "Wild magic consumes one of your %s!"), o_name);
5430 /* Reduce rod stack maximum timeout, drain wands. */
5431 if (o_ptr->tval == TV_ROD) o_ptr->timeout = MIN(o_ptr->timeout, k_ptr->pval * (o_ptr->number - 1));
5432 else if (o_ptr->tval == TV_WAND) o_ptr->pval = o_ptr->pval * (o_ptr->number - 1) / o_ptr->number;
5436 msg_format(_("乱暴な魔法のために%sが何本か壊れた!", "Wild magic consumes your %s!"), o_name);
5439 /* Reduce and describe inventory */
5442 inven_item_increase(item, -1);
5443 inven_item_describe(item);
5444 inven_item_optimize(item);
5447 /* Reduce and describe floor item */
5450 floor_item_increase(0 - item, -1);
5451 floor_item_describe(0 - item);
5452 floor_item_optimize(0 - item);
5456 /* Destroy all members of a stack of objects. */
5459 if (o_ptr->number > 1)
5460 msg_format(_("乱暴な魔法のために%sが全て壊れた!", "Wild magic consumes all your %s!"), o_name);
5462 msg_format(_("乱暴な魔法のために%sが壊れた!", "Wild magic consumes your %s!"), o_name);
5464 /* Reduce and describe inventory */
5467 inven_item_increase(item, -999);
5468 inven_item_describe(item);
5469 inven_item_optimize(item);
5472 /* Reduce and describe floor item */
5475 floor_item_increase(0 - item, -999);
5476 floor_item_describe(0 - item);
5477 floor_item_optimize(0 - item);
5483 if (p_ptr->csp > p_ptr->msp)
5485 p_ptr->csp = p_ptr->msp;
5488 /* Redraw mana and hp */
5489 p_ptr->redraw |= (PR_MANA);
5491 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
5492 p_ptr->window |= (PW_INVEN);
5499 * @param level 召喚基準レベル
5502 * @param mode 召喚オプション
5503 * @return ターンを消費した場合TRUEを返す
5505 bool summon_kin_player(DEPTH level, POSITION y, POSITION x, BIT_FLAGS mode)
5507 bool pet = (bool)(mode & PM_FORCE_PET);
5508 if (!pet) mode |= PM_NO_PET;
5510 switch (p_ptr->mimic_form)
5513 switch (p_ptr->prace)
5517 case RACE_BARBARIAN:
5520 summon_kin_type = 'p';
5530 case RACE_MIND_FLAYER:
5533 summon_kin_type = 'h';
5536 summon_kin_type = 'o';
5538 case RACE_HALF_TROLL:
5539 summon_kin_type = 'T';
5541 case RACE_HALF_OGRE:
5542 summon_kin_type = 'O';
5544 case RACE_HALF_GIANT:
5545 case RACE_HALF_TITAN:
5547 summon_kin_type = 'P';
5550 summon_kin_type = 'y';
5553 summon_kin_type = 'K';
5556 summon_kin_type = 'k';
5559 if (one_in_(13)) summon_kin_type = 'U';
5560 else summon_kin_type = 'u';
5562 case RACE_DRACONIAN:
5563 summon_kin_type = 'd';
5567 summon_kin_type = 'g';
5570 if (one_in_(13)) summon_kin_type = 'L';
5571 else summon_kin_type = 's';
5574 summon_kin_type = 'z';
5577 summon_kin_type = 'V';
5580 summon_kin_type = 'G';
5583 summon_kin_type = 'I';
5586 summon_kin_type = '#';
5589 summon_kin_type = 'A';
5592 summon_kin_type = 'U';
5595 summon_kin_type = 'p';
5600 if (one_in_(13)) summon_kin_type = 'U';
5601 else summon_kin_type = 'u';
5603 case MIMIC_DEMON_LORD:
5604 summon_kin_type = 'U';
5607 summon_kin_type = 'V';
5610 return summon_specific((pet ? -1 : 0), y, x, level, SUMMON_KIN, mode);
5614 * @brief 皆殺し(全方向攻撃)処理
5615 * @param py プレイヤーY座標
5616 * @param px プレイヤーX座標
5623 monster_type *m_ptr;
5626 for (dir = 0; dir < 8; dir++)
5628 y = p_ptr->y + ddy_ddd[dir];
5629 x = p_ptr->x + ddx_ddd[dir];
5630 c_ptr = &cave[y][x];
5632 /* Get the monster */
5633 m_ptr = &m_list[c_ptr->m_idx];
5635 /* Hack -- attack monsters */
5636 if (c_ptr->m_idx && (m_ptr->ml || cave_have_flag_bold(y, x, FF_PROJECT)))