4 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
6 * This software may be copied and distributed for educational, research,
7 * and not for profit purposes provided that this copyright and statement
8 * are included in all such copies. Other copyrights may also apply.
11 /* Purpose: Spell code (part 3) */
15 /* Maximum number of tries for teleporting */
18 /* 1/x chance of reducing stats (for elemental attacks) */
19 #define HURT_CHANCE 16
22 static bool cave_monster_teleportable_bold(int m_idx, int y, int x, bool passive)
24 monster_type *m_ptr = &m_list[m_idx];
25 cave_type *c_ptr = &cave[y][x];
26 feature_type *f_ptr = &f_info[c_ptr->feat];
28 /* Require "teleportable" space */
29 if (!have_flag(f_ptr->flags, FF_TELEPORTABLE)) return FALSE;
31 if (c_ptr->m_idx && (c_ptr->m_idx != m_idx)) return FALSE;
32 if (player_bold(y, x)) return FALSE;
34 /* Hack -- no teleport onto glyph of warding */
35 if (is_glyph_grid(c_ptr)) return FALSE;
36 if (is_explosive_rune_grid(c_ptr)) return FALSE;
40 if (!monster_can_cross_terrain(c_ptr->feat, &r_info[m_ptr->r_idx], 0)) return FALSE;
48 * Teleport a monster, normally up to "dis" grids away.
50 * Attempt to move the monster at least "dis/2" grids away.
52 * But allow variation to prevent infinite loops.
54 bool teleport_away(int m_idx, int dis, bool dec_valour, bool passive)
56 int oy, ox, d, i, min;
62 monster_type *m_ptr = &m_list[m_idx];
65 if (!m_ptr->r_idx) return (FALSE);
67 /* Save the old location */
71 /* Minimum distance */
75 (((p_ptr->chp * 10) / p_ptr->mhp) > 5) &&
76 (4+randint1(5) < ((p_ptr->chp * 10) / p_ptr->mhp)))
78 chg_virtue(V_VALOUR, -1);
86 /* Verify max distance */
87 if (dis > 200) dis = 200;
89 /* Try several locations */
90 for (i = 0; i < 500; i++)
92 /* Pick a (possibly illegal) location */
95 ny = rand_spread(oy, dis);
96 nx = rand_spread(ox, dis);
97 d = distance(oy, ox, ny, nx);
98 if ((d >= min) && (d <= dis)) break;
101 /* Ignore illegal locations */
102 if (!in_bounds(ny, nx)) continue;
104 if (!cave_monster_teleportable_bold(m_idx, ny, nx, passive)) continue;
106 /* No teleporting into vaults and such */
107 if (!(p_ptr->inside_quest || p_ptr->inside_arena))
108 if (cave[ny][nx].info & CAVE_ICKY) continue;
110 /* This grid looks good */
117 /* Increase the maximum distance */
120 /* Decrease the minimum distance */
123 /* Stop after MAX_TRIES tries */
124 if (tries > MAX_TRIES) return (FALSE);
128 sound(SOUND_TPOTHER);
130 /* Update the old location */
131 cave[oy][ox].m_idx = 0;
133 /* Update the new location */
134 cave[ny][nx].m_idx = m_idx;
136 /* Move the monster */
140 /* Forget the counter target */
143 /* Update the monster (new location) */
144 update_mon(m_idx, TRUE);
146 /* Redraw the old grid */
149 /* Redraw the new grid */
152 if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
153 p_ptr->update |= (PU_MON_LITE);
161 * Teleport monster next to a grid near the given location
163 void teleport_monster_to(int m_idx, int ty, int tx, int power, bool passive)
165 int ny, nx, oy, ox, d, i, min;
169 monster_type *m_ptr = &m_list[m_idx];
172 if (!m_ptr->r_idx) return;
175 if (randint1(100) > power) return;
181 /* Save the old location */
185 /* Minimum distance */
188 /* Look until done */
189 while (look && --attempts)
191 /* Verify max distance */
192 if (dis > 200) dis = 200;
194 /* Try several locations */
195 for (i = 0; i < 500; i++)
197 /* Pick a (possibly illegal) location */
200 ny = rand_spread(ty, dis);
201 nx = rand_spread(tx, dis);
202 d = distance(ty, tx, ny, nx);
203 if ((d >= min) && (d <= dis)) break;
206 /* Ignore illegal locations */
207 if (!in_bounds(ny, nx)) continue;
209 if (!cave_monster_teleportable_bold(m_idx, ny, nx, passive)) continue;
211 /* No teleporting into vaults and such */
212 /* if (cave[ny][nx].info & (CAVE_ICKY)) continue; */
214 /* This grid looks good */
221 /* Increase the maximum distance */
224 /* Decrease the minimum distance */
228 if (attempts < 1) return;
231 sound(SOUND_TPOTHER);
233 /* Update the old location */
234 cave[oy][ox].m_idx = 0;
236 /* Update the new location */
237 cave[ny][nx].m_idx = m_idx;
239 /* Move the monster */
243 /* Update the monster (new location) */
244 update_mon(m_idx, TRUE);
246 /* Redraw the old grid */
249 /* Redraw the new grid */
252 if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
253 p_ptr->update |= (PU_MON_LITE);
257 bool cave_player_teleportable_bold(int y, int x, bool passive, bool nonmagical)
259 cave_type *c_ptr = &cave[y][x];
260 feature_type *f_ptr = &f_info[c_ptr->feat];
262 /* Require "teleportable" space */
263 if (!have_flag(f_ptr->flags, FF_TELEPORTABLE)) return FALSE;
265 /* No magical teleporting into vaults and such */
266 if (!nonmagical && (c_ptr->info & CAVE_ICKY)) return FALSE;
268 if (c_ptr->m_idx && (c_ptr->m_idx != p_ptr->riding)) return FALSE;
272 if (!player_can_enter(c_ptr->feat, 0)) return FALSE;
274 if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP))
276 if (!p_ptr->levitation && !p_ptr->can_swim) return FALSE;
279 if (have_flag(f_ptr->flags, FF_LAVA) && !p_ptr->immune_fire && !IS_INVULN())
281 /* Always forbid deep lava */
282 if (have_flag(f_ptr->flags, FF_DEEP)) return FALSE;
284 /* Forbid shallow lava when the player don't have levitation */
285 if (!p_ptr->levitation) return FALSE;
288 if (have_flag(f_ptr->flags, FF_HIT_TRAP))
290 if (!is_known_trap(c_ptr) || !trap_can_be_ignored(c_ptr->feat)) return FALSE;
299 * Teleport the player to a location up to "dis" grids away.
301 * If no such spaces are readily available, the distance may increase.
302 * Try very hard to move the player at least a quarter that distance.
304 * There was a nasty tendency for a long time; which was causing the
305 * player to "bounce" between two or three different spots because
306 * these are the only spots that are "far enough" way to satisfy the
309 * But this tendency is now removed; in the new algorithm, a list of
310 * candidates is selected first, which includes at least 50% of all
311 * floor grids within the distance, and any single grid in this list
312 * of candidates has equal possibility to be choosen as a destination.
315 #define MAX_TELEPORT_DISTANCE 200
317 bool teleport_player_aux(int dis, bool passive, bool nonmagical)
319 int candidates_at[MAX_TELEPORT_DISTANCE + 1];
320 int total_candidates, cur_candidates;
321 int y = 0, x = 0, min, pick, i;
323 int left = MAX(1, px - dis);
324 int right = MIN(cur_wid - 2, px + dis);
325 int top = MAX(1, py - dis);
326 int bottom = MIN(cur_hgt - 2, py + dis);
328 if (p_ptr->wild_mode) return FALSE;
330 if (p_ptr->anti_tele && !nonmagical)
333 msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
335 msg_print("A mysterious force prevents you from teleporting!");
341 /* Initialize counters */
342 total_candidates = 0;
343 for (i = 0; i <= MAX_TELEPORT_DISTANCE; i++)
344 candidates_at[i] = 0;
346 /* Limit the distance */
347 if (dis > MAX_TELEPORT_DISTANCE) dis = MAX_TELEPORT_DISTANCE;
349 /* Search valid locations */
350 for (y = top; y <= bottom; y++)
352 for (x = left; x <= right; x++)
356 /* Skip illegal locations */
357 if (!cave_player_teleportable_bold(y, x, passive, nonmagical)) continue;
359 /* Calculate distance */
360 d = distance(py, px, y, x);
362 /* Skip too far locations */
363 if (d > dis) continue;
365 /* Count the total number of candidates */
368 /* Count the number of candidates in this circumference */
373 /* No valid location! */
374 if (0 == total_candidates) return FALSE;
376 /* Fix the minimum distance */
377 for (cur_candidates = 0, min = dis; min >= 0; min--)
379 cur_candidates += candidates_at[min];
381 /* 50% of all candidates will have an equal chance to be choosen. */
382 if (cur_candidates && (cur_candidates >= total_candidates / 2)) break;
385 /* Pick up a single location randomly */
386 pick = randint1(cur_candidates);
388 /* Search again the choosen location */
389 for (y = top; y <= bottom; y++)
391 for (x = left; x <= right; x++)
395 /* Skip illegal locations */
396 if (!cave_player_teleportable_bold(y, x, passive, nonmagical)) continue;
398 /* Calculate distance */
399 d = distance(py, px, y, x);
401 /* Skip too far locations */
402 if (d > dis) continue;
404 /* Skip too close locations */
405 if (d < min) continue;
407 /* This grid was picked up? */
416 if (player_bold(y, x)) return FALSE;
419 sound(SOUND_TELEPORT);
422 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
423 msg_format("¡Ø¤³¤Ã¤Á¤À¤¡¡¢%s¡Ù", player_name);
426 /* Move the player */
427 (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
432 void teleport_player(int dis, bool passive)
436 /* Save the old location */
440 if (!teleport_player_aux(dis, passive, FALSE)) return;
442 /* Monsters with teleport ability may follow the player */
443 for (xx = -1; xx < 2; xx++)
445 for (yy = -1; yy < 2; yy++)
447 int tmp_m_idx = cave[oy+yy][ox+xx].m_idx;
449 /* A monster except your mount may follow */
450 if (tmp_m_idx && (p_ptr->riding != tmp_m_idx))
452 monster_type *m_ptr = &m_list[tmp_m_idx];
453 monster_race *r_ptr = &r_info[m_ptr->r_idx];
456 * The latter limitation is to avoid
457 * totally unkillable suckers...
459 if ((r_ptr->flags6 & RF6_TPORT) &&
460 !(r_ptr->flagsr & RFR_RES_TELE))
462 if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, py, px, r_ptr->level, FALSE);
470 void teleport_player_away(int m_idx, int dis)
474 /* Save the old location */
478 if (!teleport_player_aux(dis, TRUE, FALSE)) return;
480 /* Monsters with teleport ability may follow the player */
481 for (xx = -1; xx < 2; xx++)
483 for (yy = -1; yy < 2; yy++)
485 int tmp_m_idx = cave[oy+yy][ox+xx].m_idx;
487 /* A monster except your mount or caster may follow */
488 if (tmp_m_idx && (p_ptr->riding != tmp_m_idx) && (m_idx != tmp_m_idx))
490 monster_type *m_ptr = &m_list[tmp_m_idx];
491 monster_race *r_ptr = &r_info[m_ptr->r_idx];
494 * The latter limitation is to avoid
495 * totally unkillable suckers...
497 if ((r_ptr->flags6 & RF6_TPORT) &&
498 !(r_ptr->flagsr & RFR_RES_TELE))
500 if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, py, px, r_ptr->level, FALSE);
509 * Teleport player to a grid near the given location
511 * This function is slightly obsessive about correctness.
512 * This function allows teleporting into vaults (!)
514 void teleport_player_to(int ny, int nx, bool no_tele, bool passive)
516 int y, x, dis = 0, ctr = 0;
518 if (p_ptr->anti_tele && no_tele)
521 msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
523 msg_print("A mysterious force prevents you from teleporting!");
529 /* Find a usable location */
532 /* Pick a nearby legal location */
535 y = rand_spread(ny, dis);
536 x = rand_spread(nx, dis);
537 if (in_bounds(y, x)) break;
540 /* Accept any grid when wizard mode */
541 if (p_ptr->wizard && !passive && (!cave[y][x].m_idx || (cave[y][x].m_idx == p_ptr->riding))) break;
543 /* Accept teleportable floor grids */
544 if (cave_player_teleportable_bold(y, x, passive, !no_tele)) break;
546 /* Occasionally advance the distance */
547 if (++ctr > (4 * dis * dis + 4 * dis + 1))
555 sound(SOUND_TELEPORT);
557 /* Move the player */
558 (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
562 void teleport_away_followable(int m_idx)
564 monster_type *m_ptr = &m_list[m_idx];
565 int oldfy = m_ptr->fy;
566 int oldfx = m_ptr->fx;
567 bool old_ml = m_ptr->ml;
568 int old_cdis = m_ptr->cdis;
570 teleport_away(m_idx, MAX_SIGHT * 2 + 5, FALSE, FALSE);
572 if (old_ml && (old_cdis <= MAX_SIGHT) && !world_monster && los(py, px, oldfy, oldfx))
576 if ((p_ptr->muta1 & MUT1_VTELEPORT) || (p_ptr->pclass == CLASS_IMITATOR)) follow = TRUE;
579 u32b flgs[TR_FLAG_SIZE];
583 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
585 o_ptr = &inventory[i];
586 if (o_ptr->k_idx && !object_is_cursed(o_ptr))
588 object_flags(o_ptr, flgs);
589 if (have_flag(flgs, TR_TELEPORT))
601 if (get_check_strict("¤Ä¤¤¤Æ¤¤¤¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL))
603 if (get_check_strict("Do you follow it? ", CHECK_OKAY_CANCEL))
608 teleport_player(200, TRUE);
612 msg_print("Failed!");
615 else teleport_player_to(m_ptr->fy, m_ptr->fx, TRUE, FALSE);
616 p_ptr->energy_need += ENERGY_NEED();
624 * Teleport the player one level up or down (random when legal)
625 * Note: If m_idx <= 0, target is player.
627 void teleport_level(int m_idx)
633 if (m_idx <= 0) /* To player */
636 strcpy(m_name, "¤¢¤Ê¤¿");
638 strcpy(m_name, "you");
641 else /* To monster */
643 monster_type *m_ptr = &m_list[m_idx];
645 /* Get the monster name (or "it") */
646 monster_desc(m_name, m_ptr, 0);
648 see_m = is_seen(m_ptr);
651 /* No effect in some case */
652 if (TELE_LEVEL_IS_INEFF(m_idx))
655 if (see_m) msg_print("¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£");
657 if (see_m) msg_print("There is no effect.");
663 if ((m_idx <= 0) && p_ptr->anti_tele) /* To player */
666 msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
668 msg_print("A mysterious force prevents you from teleporting!");
673 /* Choose up or down */
674 if (randint0(100) < 50) go_up = TRUE;
677 if ((m_idx <= 0) && p_ptr->wizard)
679 if (get_check("Force to go up? ")) go_up = TRUE;
680 else if (get_check("Force to go down? ")) go_up = FALSE;
684 if ((ironman_downward && (m_idx <= 0)) || (dun_level <= d_info[dungeon_type].mindepth))
687 if (see_m) msg_format("%^s¤Ï¾²¤òÆͤÇˤäÆÄÀ¤ó¤Ç¤¤¤¯¡£", m_name);
689 if (see_m) msg_format("%^s sink%s through the floor.", m_name, (m_idx <= 0) ? "" : "s");
691 if (m_idx <= 0) /* To player */
695 dungeon_type = p_ptr->recall_dungeon;
700 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL);
702 if (autosave_l) do_cmd_save_game(TRUE);
706 dun_level = d_info[dungeon_type].mindepth;
707 prepare_change_floor_mode(CFM_RAND_PLACE);
711 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
715 p_ptr->leaving = TRUE;
720 else if (quest_number(dun_level) || (dun_level >= d_info[dungeon_type].maxdepth))
723 if (see_m) msg_format("%^s¤ÏÅ·°æ¤òÆͤÇˤäÆÃè¤ØÉ⤤¤Æ¤¤¤¯¡£", m_name);
725 if (see_m) msg_format("%^s rise%s up through the ceiling.", m_name, (m_idx <= 0) ? "" : "s");
729 if (m_idx <= 0) /* To player */
731 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, -1, NULL);
733 if (autosave_l) do_cmd_save_game(TRUE);
735 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP | CFM_RAND_PLACE | CFM_RAND_CONNECT);
740 p_ptr->inside_quest = 0;
741 p_ptr->leaving = TRUE;
747 if (see_m) msg_format("%^s¤ÏÅ·°æ¤òÆͤÇˤäÆÃè¤ØÉ⤤¤Æ¤¤¤¯¡£", m_name);
749 if (see_m) msg_format("%^s rise%s up through the ceiling.", m_name, (m_idx <= 0) ? "" : "s");
753 if (m_idx <= 0) /* To player */
755 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, -1, NULL);
757 if (autosave_l) do_cmd_save_game(TRUE);
759 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP | CFM_RAND_PLACE | CFM_RAND_CONNECT);
762 p_ptr->leaving = TRUE;
768 if (see_m) msg_format("%^s¤Ï¾²¤òÆͤÇˤäÆÄÀ¤ó¤Ç¤¤¤¯¡£", m_name);
770 if (see_m) msg_format("%^s sink%s through the floor.", m_name, (m_idx <= 0) ? "" : "s");
773 if (m_idx <= 0) /* To player */
775 /* Never reach this code on the surface */
776 /* if (!dun_level) dungeon_type = p_ptr->recall_dungeon; */
778 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL);
780 if (autosave_l) do_cmd_save_game(TRUE);
782 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
785 p_ptr->leaving = TRUE;
789 /* Monster level teleportation is simple deleting now */
792 monster_type *m_ptr = &m_list[m_idx];
794 /* Check for quest completion */
795 check_quest_completion(m_ptr);
797 delete_monster_idx(m_idx);
801 sound(SOUND_TPLEVEL);
806 int choose_dungeon(cptr note, int y, int x)
812 /* Hack -- No need to choose dungeon in some case */
813 if (lite_town || vanilla_town || ironman_downward)
815 if (max_dlv[DUNGEON_ANGBAND]) return DUNGEON_ANGBAND;
819 msg_format("¤Þ¤À%s¤ËÆþ¤Ã¤¿¤³¤È¤Ï¤Ê¤¤¡£", d_name + d_info[DUNGEON_ANGBAND].name);
821 msg_format("You haven't entered %s yet.", d_name + d_info[DUNGEON_ANGBAND].name);
828 /* Allocate the "dun" array */
829 C_MAKE(dun, max_d_idx, s16b);
832 for(i = 1; i < max_d_idx; i++)
837 if (!d_info[i].maxdepth) continue;
838 if (!max_dlv[i]) continue;
839 if (d_info[i].final_guardian)
841 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
843 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
846 sprintf(buf," %c) %c%-12s : ºÇÂç %d ³¬", 'a'+num, seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
848 sprintf(buf," %c) %c%-16s : Max level %d", 'a'+num, seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
850 prt(buf, y + num, x);
857 prt(" Áª¤Ù¤ë¥À¥ó¥¸¥ç¥ó¤¬¤Ê¤¤¡£", y, x);
859 prt(" No dungeon is available.", y, x);
864 prt(format("¤É¤Î¥À¥ó¥¸¥ç¥ó%s¤·¤Þ¤¹¤«:", note), 0, 0);
866 prt(format("Which dungeon do you %s?: ", note), 0, 0);
871 if ((i == ESCAPE) || !num)
873 /* Free the "dun" array */
874 C_KILL(dun, max_d_idx, s16b);
879 if (i >= 'a' && i <('a'+num))
881 select_dungeon = dun[i-'a'];
888 /* Free the "dun" array */
889 C_KILL(dun, max_d_idx, s16b);
891 return select_dungeon;
896 * Recall the player to town or dungeon
898 bool recall_player(int turns)
901 * TODO: Recall the player to the last
902 * visited town when in the wilderness
906 if (p_ptr->inside_arena || ironman_downward)
909 msg_print("²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
911 msg_print("Nothing happens.");
917 if (dun_level && (max_dlv[dungeon_type] > dun_level) && !p_ptr->inside_quest && !p_ptr->word_recall)
920 if (get_check("¤³¤³¤ÏºÇ¿¼Åþ㳬¤è¤êÀõ¤¤³¬¤Ç¤¹¡£¤³¤Î³¬¤ËÌá¤Ã¤ÆÍè¤Þ¤¹¤«¡© "))
922 if (get_check("Reset recall depth? "))
925 max_dlv[dungeon_type] = dun_level;
928 do_cmd_write_nikki(NIKKI_TRUMP, dungeon_type, "µ¢´Ô¤Î¤È¤¤Ë");
930 do_cmd_write_nikki(NIKKI_TRUMP, dungeon_type, "when recall from dungeon");
935 if (!p_ptr->word_recall)
941 select_dungeon = choose_dungeon("¤Ëµ¢´Ô", 2, 14);
943 select_dungeon = choose_dungeon("recall", 2, 14);
945 if (!select_dungeon) return FALSE;
946 p_ptr->recall_dungeon = select_dungeon;
948 p_ptr->word_recall = turns;
950 msg_print("²ó¤ê¤ÎÂ絤¤¬Ä¥¤ê¤Ä¤á¤Æ¤¤¿...");
952 msg_print("The air about you becomes charged...");
955 p_ptr->redraw |= (PR_STATUS);
959 p_ptr->word_recall = 0;
961 msg_print("Ä¥¤ê¤Ä¤á¤¿Â絤¤¬Î®¤ìµî¤Ã¤¿...");
963 msg_print("A tension leaves the air around you...");
966 p_ptr->redraw |= (PR_STATUS);
972 bool word_of_recall(void)
974 return(recall_player(randint0(21) + 15));
978 bool reset_recall(void)
980 int select_dungeon, dummy = 0;
985 select_dungeon = choose_dungeon("¤ò¥»¥Ã¥È", 2, 14);
987 select_dungeon = choose_dungeon("reset", 2, 14);
991 if (ironman_downward)
994 msg_print("²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
996 msg_print("Nothing happens.");
1002 if (!select_dungeon) return FALSE;
1005 sprintf(ppp, "²¿³¬¤Ë¥»¥Ã¥È¤·¤Þ¤¹¤« (%d-%d):", d_info[select_dungeon].mindepth, max_dlv[select_dungeon]);
1007 sprintf(ppp, "Reset to which level (%d-%d): ", d_info[select_dungeon].mindepth, max_dlv[select_dungeon]);
1012 sprintf(tmp_val, "%d", MAX(dun_level, 1));
1014 /* Ask for a level */
1015 if (get_string(ppp, tmp_val, 10, TRUE))
1017 /* Extract request */
1018 dummy = atoi(tmp_val);
1021 if (dummy < 1) dummy = 1;
1024 if (dummy > max_dlv[select_dungeon]) dummy = max_dlv[select_dungeon];
1025 if (dummy < d_info[select_dungeon].mindepth) dummy = d_info[select_dungeon].mindepth;
1027 max_dlv[select_dungeon] = dummy;
1029 if (record_maxdepth)
1031 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "¥Õ¥í¥¢¡¦¥ê¥»¥Ã¥È¤Ç");
1033 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "using a scroll of reset recall");
1035 /* Accept request */
1037 msg_format("%s¤Îµ¢´Ô¥ì¥Ù¥ë¤ò %d ³¬¤Ë¥»¥Ã¥È¡£", d_name+d_info[select_dungeon].name, dummy, dummy * 50);
1039 msg_format("Recall depth set to level %d (%d').", dummy, dummy * 50);
1051 * Apply disenchantment to the player's stuff
1053 * XXX XXX XXX This function is also called from the "melee" code
1055 * Return "TRUE" if the player notices anything
1057 bool apply_disenchant(int mode)
1061 char o_name[MAX_NLEN];
1062 int to_h, to_d, to_a, pval;
1064 /* Pick a random slot */
1065 switch (randint1(8))
1067 case 1: t = INVEN_RARM; break;
1068 case 2: t = INVEN_LARM; break;
1069 case 3: t = INVEN_BOW; break;
1070 case 4: t = INVEN_BODY; break;
1071 case 5: t = INVEN_OUTER; break;
1072 case 6: t = INVEN_HEAD; break;
1073 case 7: t = INVEN_HANDS; break;
1074 case 8: t = INVEN_FEET; break;
1078 o_ptr = &inventory[t];
1080 /* No item, nothing happens */
1081 if (!o_ptr->k_idx) return (FALSE);
1083 /* Disenchant equipments only -- No disenchant on monster ball */
1084 if (!object_is_weapon_armour_ammo(o_ptr))
1087 /* Nothing to disenchant */
1088 if ((o_ptr->to_h <= 0) && (o_ptr->to_d <= 0) && (o_ptr->to_a <= 0) && (o_ptr->pval <= 1))
1090 /* Nothing to notice */
1095 /* Describe the object */
1096 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1099 /* Artifacts have 71% chance to resist */
1100 if (object_is_artifact(o_ptr) && (randint0(100) < 71))
1104 msg_format("%s(%c)¤ÏÎô²½¤òÄ·¤ÍÊÖ¤·¤¿¡ª",o_name, index_to_label(t) );
1106 msg_format("Your %s (%c) resist%s disenchantment!",
1107 o_name, index_to_label(t),
1108 ((o_ptr->number != 1) ? "" : "s"));
1117 /* Memorize old value */
1123 /* Disenchant tohit */
1124 if (o_ptr->to_h > 0) o_ptr->to_h--;
1125 if ((o_ptr->to_h > 5) && (randint0(100) < 20)) o_ptr->to_h--;
1127 /* Disenchant todam */
1128 if (o_ptr->to_d > 0) o_ptr->to_d--;
1129 if ((o_ptr->to_d > 5) && (randint0(100) < 20)) o_ptr->to_d--;
1131 /* Disenchant toac */
1132 if (o_ptr->to_a > 0) o_ptr->to_a--;
1133 if ((o_ptr->to_a > 5) && (randint0(100) < 20)) o_ptr->to_a--;
1135 /* Disenchant pval (occasionally) */
1136 /* Unless called from wild_magic() */
1137 if ((o_ptr->pval > 1) && one_in_(13) && !(mode & 0x01)) o_ptr->pval--;
1139 if ((to_h != o_ptr->to_h) || (to_d != o_ptr->to_d) ||
1140 (to_a != o_ptr->to_a) || (pval != o_ptr->pval))
1144 msg_format("%s(%c)¤ÏÎô²½¤·¤Æ¤·¤Þ¤Ã¤¿¡ª",
1145 o_name, index_to_label(t) );
1147 msg_format("Your %s (%c) %s disenchanted!",
1148 o_name, index_to_label(t),
1149 ((o_ptr->number != 1) ? "were" : "was"));
1152 chg_virtue(V_HARMONY, 1);
1153 chg_virtue(V_ENCHANT, -2);
1155 /* Recalculate bonuses */
1156 p_ptr->update |= (PU_BONUS);
1159 p_ptr->window |= (PW_EQUIP | PW_PLAYER);
1169 void mutate_player(void)
1171 int max1, cur1, max2, cur2, ii, jj, i;
1173 /* Pick a pair of stats */
1175 for (jj = ii; jj == ii; jj = randint0(6)) /* loop */;
1177 max1 = p_ptr->stat_max[ii];
1178 cur1 = p_ptr->stat_cur[ii];
1179 max2 = p_ptr->stat_max[jj];
1180 cur2 = p_ptr->stat_cur[jj];
1182 p_ptr->stat_max[ii] = max2;
1183 p_ptr->stat_cur[ii] = cur2;
1184 p_ptr->stat_max[jj] = max1;
1185 p_ptr->stat_cur[jj] = cur1;
1189 if(p_ptr->stat_max[i] > p_ptr->stat_max_max[i]) p_ptr->stat_max[i] = p_ptr->stat_max_max[i];
1190 if(p_ptr->stat_cur[i] > p_ptr->stat_max_max[i]) p_ptr->stat_cur[i] = p_ptr->stat_max_max[i];
1193 p_ptr->update |= (PU_BONUS);
1200 void apply_nexus(monster_type *m_ptr)
1202 switch (randint1(7))
1204 case 1: case 2: case 3:
1206 teleport_player(200, TRUE);
1212 teleport_player_to(m_ptr->fy, m_ptr->fx, TRUE, TRUE);
1218 if (randint0(100) < p_ptr->skill_sav)
1221 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
1223 msg_print("You resist the effects!");
1229 /* Teleport Level */
1236 if (randint0(100) < p_ptr->skill_sav)
1239 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
1241 msg_print("You resist the effects!");
1248 msg_print("ÂΤ¬¤Í¤¸¤ì»Ï¤á¤¿...");
1250 msg_print("Your body starts to scramble...");
1261 * Charge a lite (torch or latern)
1263 void phlogiston(void)
1266 object_type * o_ptr = &inventory[INVEN_LITE];
1269 if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_LANTERN))
1271 max_flog = FUEL_LAMP;
1275 else if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_TORCH))
1277 max_flog = FUEL_TORCH;
1280 /* No torch to refill */
1284 msg_print("dzÁǤò¾ÃÈñ¤¹¤ë¥¢¥¤¥Æ¥à¤òÁõÈ÷¤·¤Æ¤¤¤Þ¤»¤ó¡£");
1286 msg_print("You are not wielding anything which uses phlogiston.");
1292 if (o_ptr->xtra4 >= max_flog)
1295 msg_print("¤³¤Î¥¢¥¤¥Æ¥à¤Ë¤Ï¤³¤ì°Ê¾ådzÁǤòÊä½¼¤Ç¤¤Þ¤»¤ó¡£");
1297 msg_print("No more phlogiston can be put in this item.");
1304 o_ptr->xtra4 += (max_flog / 2);
1308 msg_print("¾ÈÌÀÍÑ¥¢¥¤¥Æ¥à¤ËdzÁǤòÊä½¼¤·¤¿¡£");
1310 msg_print("You add phlogiston to your light item.");
1315 if (o_ptr->xtra4 >= max_flog)
1317 o_ptr->xtra4 = max_flog;
1319 msg_print("¾ÈÌÀÍÑ¥¢¥¤¥Æ¥à¤ÏËþ¥¿¥ó¤Ë¤Ê¤Ã¤¿¡£");
1321 msg_print("Your light item is full.");
1326 /* Recalculate torch */
1327 p_ptr->update |= (PU_TORCH);
1332 * Brand the current weapon
1334 void brand_weapon(int brand_type)
1341 /* Assume enchant weapon */
1342 item_tester_hook = object_allow_enchant_melee_weapon;
1343 item_tester_no_ryoute = TRUE;
1347 q = "¤É¤ÎÉð´ï¤ò¶¯²½¤·¤Þ¤¹¤«? ";
1348 s = "¶¯²½¤Ç¤¤ëÉð´ï¤¬¤Ê¤¤¡£";
1350 q = "Enchant which weapon? ";
1351 s = "You have nothing to enchant.";
1354 if (!get_item(&item, q, s, (USE_EQUIP))) return;
1356 /* Get the item (in the pack) */
1359 o_ptr = &inventory[item];
1362 /* Get the item (on the floor) */
1365 o_ptr = &o_list[0 - item];
1369 /* you can never modify artifacts / ego-items */
1370 /* you can never modify cursed items */
1371 /* TY: You _can_ modify broken items (if you're silly enough) */
1372 if (o_ptr->k_idx && !object_is_artifact(o_ptr) && !object_is_ego(o_ptr) &&
1373 !object_is_cursed(o_ptr) &&
1374 !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) &&
1375 !((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE)) &&
1376 !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DIAMOND_EDGE)))
1380 /* Let's get the name before it is changed... */
1381 char o_name[MAX_NLEN];
1382 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1387 if (o_ptr->tval == TV_SWORD)
1390 act = "¤Ï±Ô¤µ¤òÁý¤·¤¿¡ª";
1392 act = "becomes very sharp!";
1395 o_ptr->name2 = EGO_SHARPNESS;
1396 o_ptr->pval = m_bonus(5, dun_level) + 1;
1398 if ((o_ptr->sval == SV_HAYABUSA) && (o_ptr->pval > 2))
1404 act = "¤ÏÇ˲õÎϤòÁý¤·¤¿¡ª";
1406 act = "seems very powerful.";
1409 o_ptr->name2 = EGO_EARTHQUAKES;
1410 o_ptr->pval = m_bonus(3, dun_level);
1415 act = "¤Ï¿Í´Ö¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1417 act = "seems to be looking for humans!";
1420 o_ptr->name2 = EGO_SLAY_HUMAN;
1424 act = "¤ÏÅÅ·â¤Ëʤ¤ï¤ì¤¿¡ª";
1426 act = "covered with lightning!";
1429 o_ptr->name2 = EGO_BRAND_ELEC;
1433 act = "¤Ï»À¤Ëʤ¤ï¤ì¤¿¡ª";
1435 act = "coated with acid!";
1438 o_ptr->name2 = EGO_BRAND_ACID;
1442 act = "¤Ï¼Ù°¤Ê¤ë²øʪ¤òµá¤á¤Æ¤¤¤ë¡ª";
1444 act = "seems to be looking for evil monsters!";
1447 o_ptr->name2 = EGO_SLAY_EVIL;
1451 act = "¤Ï°ÛÀ¤³¦¤Î½»¿Í¤ÎÆùÂΤòµá¤á¤Æ¤¤¤ë¡ª";
1453 act = "seems to be looking for demons!";
1456 o_ptr->name2 = EGO_SLAY_DEMON;
1460 act = "¤Ï»Ó¤òµá¤á¤Æ¤¤¤ë¡ª";
1462 act = "seems to be looking for undead!";
1465 o_ptr->name2 = EGO_SLAY_UNDEAD;
1469 act = "¤Ïưʪ¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1471 act = "seems to be looking for animals!";
1474 o_ptr->name2 = EGO_SLAY_ANIMAL;
1478 act = "¤Ï¥É¥é¥´¥ó¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1480 act = "seems to be looking for dragons!";
1483 o_ptr->name2 = EGO_SLAY_DRAGON;
1487 act = "¤Ï¥È¥í¥ë¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1489 act = "seems to be looking for troll!s";
1492 o_ptr->name2 = EGO_SLAY_TROLL;
1496 act = "¤Ï¥ª¡¼¥¯¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1498 act = "seems to be looking for orcs!";
1501 o_ptr->name2 = EGO_SLAY_ORC;
1505 act = "¤Ïµð¿Í¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1507 act = "seems to be looking for giants!";
1510 o_ptr->name2 = EGO_SLAY_GIANT;
1514 act = "¤ÏÈó¾ï¤ËÉÔ°ÂÄê¤Ë¤Ê¤Ã¤¿¤è¤¦¤À¡£";
1516 act = "seems very unstable now.";
1519 o_ptr->name2 = EGO_TRUMP;
1520 o_ptr->pval = randint1(2);
1524 act = "¤Ï·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1526 act = "thirsts for blood!";
1529 o_ptr->name2 = EGO_VAMPIRIC;
1533 act = "¤ÏÆǤËʤ¤ï¤ì¤¿¡£";
1535 act = "is coated with poison.";
1538 o_ptr->name2 = EGO_BRAND_POIS;
1542 act = "¤Ï½ã¥í¥°¥ë¥¹¤Ë°û¤ß¹þ¤Þ¤ì¤¿¡£";
1544 act = "is engulfed in raw Logrus!";
1547 o_ptr->name2 = EGO_CHAOTIC;
1551 act = "¤Ï±ê¤Î¥·¡¼¥ë¥É¤Ëʤ¤ï¤ì¤¿¡ª";
1553 act = "is covered in a fiery shield!";
1556 o_ptr->name2 = EGO_BRAND_FIRE;
1560 act = "¤Ï¿¼¤¯Î䤿¤¤¥Ö¥ë¡¼¤Ëµ±¤¤¤¿¡ª";
1562 act = "glows deep, icy blue!";
1565 o_ptr->name2 = EGO_BRAND_COLD;
1570 msg_format("¤¢¤Ê¤¿¤Î%s%s", o_name, act);
1572 msg_format("Your %s %s", o_name, act);
1576 enchant(o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
1578 o_ptr->discount = 99;
1579 chg_virtue(V_ENCHANT, 2);
1583 if (flush_failure) flush();
1586 msg_print("°ÀÉղä˼ºÇÔ¤·¤¿¡£");
1588 msg_print("The Branding failed.");
1591 chg_virtue(V_ENCHANT, -2);
1598 * Vanish all walls in this floor
1600 static bool vanish_dungeon(void)
1604 feature_type *f_ptr;
1605 monster_type *m_ptr;
1608 /* Prevent vasishing of quest levels and town */
1609 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1614 /* Scan all normal grids */
1615 for (y = 1; y < cur_hgt - 1; y++)
1617 for (x = 1; x < cur_wid - 1; x++)
1619 c_ptr = &cave[y][x];
1621 /* Seeing true feature code (ignore mimic) */
1622 f_ptr = &f_info[c_ptr->feat];
1624 /* Lose room and vault */
1625 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1627 m_ptr = &m_list[c_ptr->m_idx];
1630 if (c_ptr->m_idx && MON_CSLEEP(m_ptr))
1632 /* Reset sleep counter */
1633 (void)set_monster_csleep(c_ptr->m_idx, 0);
1635 /* Notice the "waking up" */
1638 /* Acquire the monster name */
1639 monster_desc(m_name, m_ptr, 0);
1641 /* Dump a message */
1643 msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
1645 msg_format("%^s wakes up.", m_name);
1650 /* Process all walls, doors and patterns */
1651 if (have_flag(f_ptr->flags, FF_HURT_DISI)) cave_alter_feat(y, x, FF_HURT_DISI);
1655 /* Special boundary walls -- Top and bottom */
1656 for (x = 0; x < cur_wid; x++)
1658 c_ptr = &cave[0][x];
1659 f_ptr = &f_info[c_ptr->mimic];
1661 /* Lose room and vault */
1662 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1664 /* Set boundary mimic if needed */
1665 if (c_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI))
1667 c_ptr->mimic = feat_state(c_ptr->mimic, FF_HURT_DISI);
1669 /* Check for change to boring grid */
1670 if (!have_flag(f_info[c_ptr->mimic].flags, FF_REMEMBER)) c_ptr->info &= ~(CAVE_MARK);
1673 c_ptr = &cave[cur_hgt - 1][x];
1674 f_ptr = &f_info[c_ptr->mimic];
1676 /* Lose room and vault */
1677 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1679 /* Set boundary mimic if needed */
1680 if (c_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI))
1682 c_ptr->mimic = feat_state(c_ptr->mimic, FF_HURT_DISI);
1684 /* Check for change to boring grid */
1685 if (!have_flag(f_info[c_ptr->mimic].flags, FF_REMEMBER)) c_ptr->info &= ~(CAVE_MARK);
1689 /* Special boundary walls -- Left and right */
1690 for (y = 1; y < (cur_hgt - 1); y++)
1692 c_ptr = &cave[y][0];
1693 f_ptr = &f_info[c_ptr->mimic];
1695 /* Lose room and vault */
1696 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1698 /* Set boundary mimic if needed */
1699 if (c_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI))
1701 c_ptr->mimic = feat_state(c_ptr->mimic, FF_HURT_DISI);
1703 /* Check for change to boring grid */
1704 if (!have_flag(f_info[c_ptr->mimic].flags, FF_REMEMBER)) c_ptr->info &= ~(CAVE_MARK);
1707 c_ptr = &cave[y][cur_wid - 1];
1708 f_ptr = &f_info[c_ptr->mimic];
1710 /* Lose room and vault */
1711 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1713 /* Set boundary mimic if needed */
1714 if (c_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI))
1716 c_ptr->mimic = feat_state(c_ptr->mimic, FF_HURT_DISI);
1718 /* Check for change to boring grid */
1719 if (!have_flag(f_info[c_ptr->mimic].flags, FF_REMEMBER)) c_ptr->info &= ~(CAVE_MARK);
1723 /* Mega-Hack -- Forget the view and lite */
1724 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1727 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
1729 /* Update the monsters */
1730 p_ptr->update |= (PU_MONSTERS);
1733 p_ptr->redraw |= (PR_MAP);
1736 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1742 void call_the_(void)
1746 bool do_call = TRUE;
1748 for (i = 0; i < 9; i++)
1750 c_ptr = &cave[py + ddy_ddd[i]][px + ddx_ddd[i]];
1752 if (!cave_have_flag_grid(c_ptr, FF_PROJECT))
1754 if (!c_ptr->mimic || !have_flag(f_info[c_ptr->mimic].flags, FF_PROJECT) ||
1755 !permanent_wall(&f_info[c_ptr->feat]))
1765 for (i = 1; i < 10; i++)
1767 if (i - 5) fire_ball(GF_ROCKET, i, 175, 2);
1770 for (i = 1; i < 10; i++)
1772 if (i - 5) fire_ball(GF_MANA, i, 175, 3);
1775 for (i = 1; i < 10; i++)
1777 if (i - 5) fire_ball(GF_NUKE, i, 175, 4);
1781 /* Prevent destruction of quest levels and town */
1782 else if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1785 msg_print("ÃÏÌ̤¬Íɤ줿¡£");
1787 msg_print("The ground trembles.");
1794 msg_format("¤¢¤Ê¤¿¤Ï%s¤òÊɤ˶᤹¤®¤ë¾ì½ê¤Ç¾§¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª",
1795 ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "µ§¤ê" : "¼öʸ"));
1796 msg_print("Â礤ÊÇúȯ²»¤¬¤¢¤Ã¤¿¡ª");
1798 msg_format("You %s the %s too close to a wall!",
1799 ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "recite" : "cast"),
1800 ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "prayer" : "spell"));
1801 msg_print("There is a loud explosion!");
1807 if (!vanish_dungeon()) msg_print("¥À¥ó¥¸¥ç¥ó¤Ï°ì½ÖÀŤޤêÊ֤ä¿¡£");
1809 if (!vanish_dungeon()) msg_print("The dungeon silences a moment.");
1814 if (destroy_area(py, px, 15 + p_ptr->lev + randint0(11), FALSE))
1816 msg_print("¥À¥ó¥¸¥ç¥ó¤¬Êø²õ¤·¤¿...");
1818 msg_print("The dungeon collapses...");
1823 msg_print("¥À¥ó¥¸¥ç¥ó¤ÏÂ礤¯Íɤ줿¡£");
1825 msg_print("The dungeon trembles.");
1830 take_hit(DAMAGE_NOESCAPE, 100 + randint1(150), "¼«»¦Åª¤Êµõ̵¾·Íè", -1);
1832 take_hit(DAMAGE_NOESCAPE, 100 + randint1(150), "a suicidal Call the Void", -1);
1839 * Fetch an item (teleport it right underneath the caster)
1841 void fetch(int dir, int wgt, bool require_los)
1846 char o_name[MAX_NLEN];
1848 /* Check to see if an object is already there */
1849 if (cave[py][px].o_idx)
1852 msg_print("¼«Ê¬¤Î¤β¼¤Ë¤¢¤ëʪ¤Ï¼è¤ì¤Þ¤»¤ó¡£");
1854 msg_print("You can't fetch when you're already standing on something.");
1861 if (dir == 5 && target_okay())
1866 if (distance(py, px, ty, tx) > MAX_RANGE)
1869 msg_print("¤½¤ó¤Ê¤Ë±ó¤¯¤Ë¤¢¤ëʪ¤Ï¼è¤ì¤Þ¤»¤ó¡ª");
1871 msg_print("You can't fetch something that far away!");
1877 c_ptr = &cave[ty][tx];
1879 /* We need an item to fetch */
1883 msg_print("¤½¤³¤Ë¤Ï²¿¤â¤¢¤ê¤Þ¤»¤ó¡£");
1885 msg_print("There is no object at this place.");
1891 /* No fetching from vault */
1892 if (c_ptr->info & CAVE_ICKY)
1895 msg_print("¥¢¥¤¥Æ¥à¤¬¥³¥ó¥È¥í¡¼¥ë¤ò³°¤ì¤ÆÍî¤Á¤¿¡£");
1897 msg_print("The item slips from your control.");
1903 /* We need to see the item */
1906 if (!player_has_los_bold(ty, tx))
1909 msg_print("¤½¤³¤Ï¤¢¤Ê¤¿¤Î»ë³¦¤ËÆþ¤Ã¤Æ¤¤¤Þ¤»¤ó¡£");
1911 msg_print("You have no direct line of sight to that location.");
1916 else if (!projectable(py, px, ty, tx))
1919 msg_print("¤½¤³¤ÏÊɤθþ¤³¤¦¤Ç¤¹¡£");
1921 msg_print("You have no direct line of sight to that location.");
1930 /* Use a direction */
1931 ty = py; /* Where to drop the item */
1938 c_ptr = &cave[ty][tx];
1940 if ((distance(py, px, ty, tx) > MAX_RANGE) ||
1941 !cave_have_flag_bold(ty, tx, FF_PROJECT)) return;
1943 while (!c_ptr->o_idx);
1946 o_ptr = &o_list[c_ptr->o_idx];
1948 if (o_ptr->weight > wgt)
1950 /* Too heavy to 'fetch' */
1952 msg_print("¤½¤Î¥¢¥¤¥Æ¥à¤Ï½Å²á¤®¤Þ¤¹¡£");
1954 msg_print("The object is too heavy.");
1961 c_ptr->o_idx = o_ptr->next_o_idx;
1962 cave[py][px].o_idx = i; /* 'move' it */
1963 o_ptr->next_o_idx = 0;
1964 o_ptr->iy = (byte)py;
1965 o_ptr->ix = (byte)px;
1967 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1969 msg_format("%^s¤¬¤¢¤Ê¤¿¤Î¸µ¤ËÈô¤ó¤Ç¤¤¿¡£", o_name);
1971 msg_format("%^s flies through the air to your feet.", o_name);
1976 p_ptr->redraw |= PR_MAP;
1980 void alter_reality(void)
1982 /* Ironman option */
1983 if (p_ptr->inside_arena || ironman_downward)
1986 msg_print("²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
1988 msg_print("Nothing happens.");
1993 if (!p_ptr->alter_reality)
1995 int turns = randint0(21) + 15;
1997 p_ptr->alter_reality = turns;
1999 msg_print("²ó¤ê¤Î·Ê¿§¤¬ÊѤï¤ê»Ï¤á¤¿...");
2001 msg_print("The view around you begins to change...");
2004 p_ptr->redraw |= (PR_STATUS);
2008 p_ptr->alter_reality = 0;
2010 msg_print("·Ê¿§¤¬¸µ¤ËÌá¤Ã¤¿...");
2012 msg_print("The view around you got back...");
2015 p_ptr->redraw |= (PR_STATUS);
2022 * Leave a "glyph of warding" which prevents monster movement
2024 bool warding_glyph(void)
2027 if (!cave_clean_bold(py, px))
2030 msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£");
2032 msg_print("The object resists the spell.");
2038 /* Create a glyph */
2039 cave[py][px].info |= CAVE_OBJECT;
2040 cave[py][px].mimic = FEAT_GLYPH;
2051 bool place_mirror(void)
2054 if (!cave_clean_bold(py, px))
2057 msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£");
2059 msg_print("The object resists the spell.");
2065 /* Create a mirror */
2066 cave[py][px].info |= CAVE_OBJECT;
2067 cave[py][px].mimic = FEAT_MIRROR;
2069 /* Turn on the light */
2070 cave[py][px].info |= CAVE_GLOW;
2078 update_local_illumination(py, px);
2085 * Leave an "explosive rune" which prevents monster movement
2087 bool explosive_rune(void)
2090 if (!cave_clean_bold(py, px))
2093 msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£");
2095 msg_print("The object resists the spell.");
2101 /* Create a glyph */
2102 cave[py][px].info |= CAVE_OBJECT;
2103 cave[py][px].mimic = FEAT_MINOR_GLYPH;
2116 * Identify everything being carried.
2117 * Done by a potion of "self knowledge".
2119 void identify_pack(void)
2123 /* Simply identify and know every item */
2124 for (i = 0; i < INVEN_TOTAL; i++)
2126 object_type *o_ptr = &inventory[i];
2128 /* Skip non-objects */
2129 if (!o_ptr->k_idx) continue;
2132 identify_item(o_ptr);
2134 /* Auto-inscription */
2135 autopick_alter_item(i, FALSE);
2141 * Used by the "enchant" function (chance of failure)
2142 * (modified for Zangband, we need better stuff there...) -- TY
2144 static int enchant_table[16] =
2146 0, 10, 50, 100, 200,
2147 300, 400, 500, 650, 800,
2148 950, 987, 993, 995, 998,
2154 * Removes curses from items in inventory
2156 * Note that Items which are "Perma-Cursed" (The One Ring,
2157 * The Crown of Morgoth) can NEVER be uncursed.
2159 * Note that if "all" is FALSE, then Items which are
2160 * "Heavy-Cursed" (Mormegil, Calris, and Weapons of Morgul)
2161 * will not be uncursed.
2163 static int remove_curse_aux(int all)
2167 /* Attempt to uncurse items being worn */
2168 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2170 object_type *o_ptr = &inventory[i];
2172 /* Skip non-objects */
2173 if (!o_ptr->k_idx) continue;
2175 /* Uncursed already */
2176 if (!object_is_cursed(o_ptr)) continue;
2178 /* Heavily Cursed Items need a special spell */
2179 if (!all && (o_ptr->curse_flags & TRC_HEAVY_CURSE)) continue;
2181 /* Perma-Cursed Items can NEVER be uncursed */
2182 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
2185 o_ptr->curse_flags &= (TRC_CURSED | TRC_HEAVY_CURSE | TRC_PERMA_CURSE);
2190 o_ptr->curse_flags = 0L;
2192 /* Hack -- Assume felt */
2193 o_ptr->ident |= (IDENT_SENSE);
2196 o_ptr->feeling = FEEL_NONE;
2198 /* Recalculate the bonuses */
2199 p_ptr->update |= (PU_BONUS);
2202 p_ptr->window |= (PW_EQUIP);
2204 /* Count the uncursings */
2208 /* Return "something uncursed" */
2214 * Remove most curses
2216 bool remove_curse(void)
2218 return (remove_curse_aux(FALSE));
2224 bool remove_all_curse(void)
2226 return (remove_curse_aux(TRUE));
2231 * Turns an object into gold, gain some of its value in a shop
2240 char o_name[MAX_NLEN];
2241 char out_val[MAX_NLEN+40];
2245 /* Hack -- force destruction */
2246 if (command_arg > 0) force = TRUE;
2250 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò¶â¤ËÊѤ¨¤Þ¤¹¤«¡©";
2251 s = "¶â¤ËÊѤ¨¤é¤ì¤ëʪ¤¬¤¢¤ê¤Þ¤»¤ó¡£";
2253 q = "Turn which item to gold? ";
2254 s = "You have nothing to turn to gold.";
2257 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return (FALSE);
2259 /* Get the item (in the pack) */
2262 o_ptr = &inventory[item];
2265 /* Get the item (on the floor) */
2268 o_ptr = &o_list[0 - item];
2272 /* See how many items */
2273 if (o_ptr->number > 1)
2275 /* Get a quantity */
2276 amt = get_quantity(NULL, o_ptr->number);
2278 /* Allow user abort */
2279 if (amt <= 0) return FALSE;
2283 /* Describe the object */
2284 old_number = o_ptr->number;
2285 o_ptr->number = amt;
2286 object_desc(o_name, o_ptr, 0);
2287 o_ptr->number = old_number;
2289 /* Verify unless quantity given */
2292 if (confirm_destroy || (object_value(o_ptr) > 0))
2294 /* Make a verification */
2296 sprintf(out_val, "ËÜÅö¤Ë%s¤ò¶â¤ËÊѤ¨¤Þ¤¹¤«¡©", o_name);
2298 sprintf(out_val, "Really turn %s to gold? ", o_name);
2301 if (!get_check(out_val)) return FALSE;
2305 /* Artifacts cannot be destroyed */
2306 if (!can_player_destroy_object(o_ptr))
2310 msg_format("%s¤ò¶â¤ËÊѤ¨¤ë¤³¤È¤Ë¼ºÇÔ¤·¤¿¡£", o_name);
2312 msg_format("You fail to turn %s to gold!", o_name);
2319 price = object_value_real(o_ptr);
2325 msg_format("%s¤ò¥Ë¥»¤Î¶â¤ËÊѤ¨¤¿¡£", o_name);
2327 msg_format("You turn %s to fool's gold.", o_name);
2335 if (amt > 1) price *= amt;
2337 if (price > 30000) price = 30000;
2339 msg_format("%s¤ò¡ð%d ¤Î¶â¤ËÊѤ¨¤¿¡£", o_name, price);
2341 msg_format("You turn %s to %ld coins worth of gold.", o_name, price);
2347 p_ptr->redraw |= (PR_GOLD);
2350 p_ptr->window |= (PW_PLAYER);
2354 /* Eliminate the item (from the pack) */
2357 inven_item_increase(item, -amt);
2358 inven_item_describe(item);
2359 inven_item_optimize(item);
2362 /* Eliminate the item (from the floor) */
2365 floor_item_increase(0 - item, -amt);
2366 floor_item_describe(0 - item);
2367 floor_item_optimize(0 - item);
2375 * Break the curse of an item
2377 static void break_curse(object_type *o_ptr)
2379 if (object_is_cursed(o_ptr) && !(o_ptr->curse_flags & TRC_PERMA_CURSE) && !(o_ptr->curse_flags & TRC_HEAVY_CURSE) && (randint0(100) < 25))
2382 msg_print("¤«¤±¤é¤ì¤Æ¤¤¤¿¼ö¤¤¤¬ÂǤÁÇˤé¤ì¤¿¡ª");
2384 msg_print("The curse is broken!");
2387 o_ptr->curse_flags = 0L;
2389 o_ptr->ident |= (IDENT_SENSE);
2391 o_ptr->feeling = FEEL_NONE;
2397 * Enchants a plus onto an item. -RAK-
2399 * Revamped! Now takes item pointer, number of times to try enchanting,
2400 * and a flag of what to try enchanting. Artifacts resist enchantment
2401 * some of the time, and successful enchantment to at least +0 might
2402 * break a curse on the item. -CFT-
2404 * Note that an item can technically be enchanted all the way to +15 if
2405 * you wait a very, very, long time. Going from +9 to +10 only works
2406 * about 5% of the time, and from +10 to +11 only about 1% of the time.
2408 * Note that this function can now be used on "piles" of items, and
2409 * the larger the pile, the lower the chance of success.
2411 bool enchant(object_type *o_ptr, int n, int eflag)
2413 int i, chance, prob;
2415 bool a = object_is_artifact(o_ptr);
2416 bool force = (eflag & ENCH_FORCE);
2419 /* Large piles resist enchantment */
2420 prob = o_ptr->number * 100;
2422 /* Missiles are easy to enchant */
2423 if ((o_ptr->tval == TV_BOLT) ||
2424 (o_ptr->tval == TV_ARROW) ||
2425 (o_ptr->tval == TV_SHOT))
2431 for (i = 0; i < n; i++)
2433 /* Hack -- Roll for pile resistance */
2434 if (!force && randint0(prob) >= 100) continue;
2436 /* Enchant to hit */
2437 if (eflag & ENCH_TOHIT)
2439 if (o_ptr->to_h < 0) chance = 0;
2440 else if (o_ptr->to_h > 15) chance = 1000;
2441 else chance = enchant_table[o_ptr->to_h];
2443 if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
2448 /* only when you get it above -1 -CFT */
2449 if (o_ptr->to_h >= 0)
2454 /* Enchant to damage */
2455 if (eflag & ENCH_TODAM)
2457 if (o_ptr->to_d < 0) chance = 0;
2458 else if (o_ptr->to_d > 15) chance = 1000;
2459 else chance = enchant_table[o_ptr->to_d];
2461 if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
2466 /* only when you get it above -1 -CFT */
2467 if (o_ptr->to_d >= 0)
2472 /* Enchant to armor class */
2473 if (eflag & ENCH_TOAC)
2475 if (o_ptr->to_a < 0) chance = 0;
2476 else if (o_ptr->to_a > 15) chance = 1000;
2477 else chance = enchant_table[o_ptr->to_a];
2479 if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
2484 /* only when you get it above -1 -CFT */
2485 if (o_ptr->to_a >= 0)
2492 if (!res) return (FALSE);
2494 /* Recalculate bonuses */
2495 p_ptr->update |= (PU_BONUS);
2497 /* Combine / Reorder the pack (later) */
2498 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2501 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2512 * Enchant an item (in the inventory or on the floor)
2513 * Note that "num_ac" requires armour, else weapon
2514 * Returns TRUE if attempted, FALSE if cancelled
2516 bool enchant_spell(int num_hit, int num_dam, int num_ac)
2521 char o_name[MAX_NLEN];
2525 /* Assume enchant weapon */
2526 item_tester_hook = object_allow_enchant_weapon;
2527 item_tester_no_ryoute = TRUE;
2529 /* Enchant armor if requested */
2530 if (num_ac) item_tester_hook = object_is_armour;
2534 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò¶¯²½¤·¤Þ¤¹¤«? ";
2535 s = "¶¯²½¤Ç¤¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2537 q = "Enchant which item? ";
2538 s = "You have nothing to enchant.";
2541 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2543 /* Get the item (in the pack) */
2546 o_ptr = &inventory[item];
2549 /* Get the item (on the floor) */
2552 o_ptr = &o_list[0 - item];
2557 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2561 msg_format("%s ¤ÏÌÀ¤ë¤¯µ±¤¤¤¿¡ª",
2564 msg_format("%s %s glow%s brightly!",
2565 ((item >= 0) ? "Your" : "The"), o_name,
2566 ((o_ptr->number > 1) ? "" : "s"));
2571 if (enchant(o_ptr, num_hit, ENCH_TOHIT)) okay = TRUE;
2572 if (enchant(o_ptr, num_dam, ENCH_TODAM)) okay = TRUE;
2573 if (enchant(o_ptr, num_ac, ENCH_TOAC)) okay = TRUE;
2579 if (flush_failure) flush();
2583 msg_print("¶¯²½¤Ë¼ºÇÔ¤·¤¿¡£");
2585 msg_print("The enchantment failed.");
2588 if (one_in_(3)) chg_virtue(V_ENCHANT, -1);
2591 chg_virtue(V_ENCHANT, 1);
2595 /* Something happened */
2601 * Check if an object is nameless weapon or armour
2603 static bool item_tester_hook_nameless_weapon_armour(object_type *o_ptr)
2605 /* Require weapon or armour */
2606 if (!object_is_weapon_armour_ammo(o_ptr)) return FALSE;
2608 /* Require nameless object if the object is well known */
2609 if (object_is_known(o_ptr) && !object_is_nameless(o_ptr))
2616 bool artifact_scroll(void)
2621 char o_name[MAX_NLEN];
2625 item_tester_no_ryoute = TRUE;
2627 /* Enchant weapon/armour */
2628 item_tester_hook = item_tester_hook_nameless_weapon_armour;
2632 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò¶¯²½¤·¤Þ¤¹¤«? ";
2633 s = "¶¯²½¤Ç¤¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2635 q = "Enchant which item? ";
2636 s = "You have nothing to enchant.";
2639 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2641 /* Get the item (in the pack) */
2644 o_ptr = &inventory[item];
2647 /* Get the item (on the floor) */
2650 o_ptr = &o_list[0 - item];
2655 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2659 msg_format("%s ¤ÏâÁ¤¤¸÷¤òȯ¤·¤¿¡ª",o_name);
2661 msg_format("%s %s radiate%s a blinding light!",
2662 ((item >= 0) ? "Your" : "The"), o_name,
2663 ((o_ptr->number > 1) ? "" : "s"));
2666 if (object_is_artifact(o_ptr))
2669 msg_format("%s¤Ï´û¤ËÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Ç¤¹¡ª", o_name );
2671 msg_format("The %s %s already %s!",
2672 o_name, ((o_ptr->number > 1) ? "are" : "is"),
2673 ((o_ptr->number > 1) ? "artifacts" : "an artifact"));
2679 else if (object_is_ego(o_ptr))
2682 msg_format("%s¤Ï´û¤Ë̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à¤Ç¤¹¡ª", o_name );
2684 msg_format("The %s %s already %s!",
2685 o_name, ((o_ptr->number > 1) ? "are" : "is"),
2686 ((o_ptr->number > 1) ? "ego items" : "an ego item"));
2692 else if (o_ptr->xtra3)
2695 msg_format("%s¤Ï´û¤Ë¶¯²½¤µ¤ì¤Æ¤¤¤Þ¤¹¡ª", o_name );
2697 msg_format("The %s %s already %s!",
2698 o_name, ((o_ptr->number > 1) ? "are" : "is"),
2699 ((o_ptr->number > 1) ? "customized items" : "a customized item"));
2705 if (o_ptr->number > 1)
2708 msg_print("Ê£¿ô¤Î¥¢¥¤¥Æ¥à¤ËËâË¡¤ò¤«¤±¤ë¤À¤±¤Î¥¨¥Í¥ë¥®¡¼¤Ï¤¢¤ê¤Þ¤»¤ó¡ª");
2709 msg_format("%d ¸Ä¤Î%s¤¬²õ¤ì¤¿¡ª",(o_ptr->number)-1, o_name);
2711 msg_print("Not enough enough energy to enchant more than one object!");
2712 msg_format("%d of your %s %s destroyed!",(o_ptr->number)-1, o_name, (o_ptr->number>2?"were":"was"));
2717 inven_item_increase(item, 1-(o_ptr->number));
2721 floor_item_increase(0-item, 1-(o_ptr->number));
2724 okay = create_artifact(o_ptr, TRUE);
2731 if (flush_failure) flush();
2735 msg_print("¶¯²½¤Ë¼ºÇÔ¤·¤¿¡£");
2737 msg_print("The enchantment failed.");
2740 if (one_in_(3)) chg_virtue(V_ENCHANT, -1);
2743 chg_virtue(V_ENCHANT, 1);
2747 /* Something happened */
2753 * Identify an object
2755 bool identify_item(object_type *o_ptr)
2757 bool old_known = FALSE;
2758 char o_name[MAX_NLEN];
2761 object_desc(o_name, o_ptr, 0);
2763 if (o_ptr->ident & IDENT_KNOWN)
2766 if (!(o_ptr->ident & (IDENT_MENTAL)))
2768 if (object_is_artifact(o_ptr) || one_in_(5))
2769 chg_virtue(V_KNOWLEDGE, 1);
2772 /* Identify it fully */
2773 object_aware(o_ptr);
2774 object_known(o_ptr);
2776 /* Recalculate bonuses */
2777 p_ptr->update |= (PU_BONUS);
2779 /* Combine / Reorder the pack (later) */
2780 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2783 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2785 strcpy(record_o_name, o_name);
2789 object_desc(o_name, o_ptr, OD_NAME_ONLY);
2791 if(record_fix_art && !old_known && object_is_fixed_artifact(o_ptr))
2792 do_cmd_write_nikki(NIKKI_ART, 0, o_name);
2793 if(record_rand_art && !old_known && o_ptr->art_name)
2794 do_cmd_write_nikki(NIKKI_ART, 0, o_name);
2800 static bool item_tester_hook_identify(object_type *o_ptr)
2802 return (bool)!object_is_known(o_ptr);
2805 static bool item_tester_hook_identify_weapon_armour(object_type *o_ptr)
2807 if (object_is_known(o_ptr))
2809 return object_is_weapon_armour_ammo(o_ptr);
2813 * Identify an object in the inventory (or on the floor)
2814 * This routine does *not* automatically combine objects.
2815 * Returns TRUE if something was identified, else FALSE.
2817 bool ident_spell(bool only_equip)
2821 char o_name[MAX_NLEN];
2825 item_tester_no_ryoute = TRUE;
2828 item_tester_hook = item_tester_hook_identify_weapon_armour;
2830 item_tester_hook = item_tester_hook_identify;
2832 if (!can_get_item())
2836 item_tester_hook = object_is_weapon_armour_ammo;
2840 item_tester_hook = NULL;
2846 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò´ÕÄꤷ¤Þ¤¹¤«? ";
2847 s = "´ÕÄꤹ¤ë¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2849 q = "Identify which item? ";
2850 s = "You have nothing to identify.";
2853 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2855 /* Get the item (in the pack) */
2858 o_ptr = &inventory[item];
2861 /* Get the item (on the floor) */
2864 o_ptr = &o_list[0 - item];
2868 old_known = identify_item(o_ptr);
2871 object_desc(o_name, o_ptr, 0);
2874 if (item >= INVEN_RARM)
2877 msg_format("%^s: %s(%c)¡£", describe_use(item), o_name, index_to_label(item));
2879 msg_format("%^s: %s (%c).", describe_use(item), o_name, index_to_label(item));
2885 msg_format("¥¶¥Ã¥¯Ãæ: %s(%c)¡£", o_name, index_to_label(item));
2887 msg_format("In your pack: %s (%c).", o_name, index_to_label(item));
2893 msg_format("¾²¾å: %s¡£", o_name);
2895 msg_format("On the ground: %s.", o_name);
2899 /* Auto-inscription/destroy */
2900 autopick_alter_item(item, (bool)(destroy_identify && !old_known));
2902 /* Something happened */
2908 * Mundanify an object in the inventory (or on the floor)
2909 * This routine does *not* automatically combine objects.
2910 * Returns TRUE if something was mundanified, else FALSE.
2912 bool mundane_spell(bool only_equip)
2918 if (only_equip) item_tester_hook = object_is_weapon_armour_ammo;
2919 item_tester_no_ryoute = TRUE;
2923 q = "¤É¤ì¤ò»È¤¤¤Þ¤¹¤«¡©";
2924 s = "»È¤¨¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
2926 q = "Use which item? ";
2927 s = "You have nothing you can use.";
2930 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2932 /* Get the item (in the pack) */
2935 o_ptr = &inventory[item];
2938 /* Get the item (on the floor) */
2941 o_ptr = &o_list[0 - item];
2946 msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
2948 msg_print("There is a bright flash of light!");
2951 byte iy = o_ptr->iy; /* Y-position on map, or zero */
2952 byte ix = o_ptr->ix; /* X-position on map, or zero */
2953 s16b next_o_idx = o_ptr->next_o_idx; /* Next object in stack (if any) */
2954 byte marked = o_ptr->marked; /* Object is marked */
2955 s16b weight = o_ptr->number * o_ptr->weight;
2956 u16b inscription = o_ptr->inscription;
2959 object_prep(o_ptr, o_ptr->k_idx);
2963 o_ptr->next_o_idx = next_o_idx;
2964 o_ptr->marked = marked;
2965 o_ptr->inscription = inscription;
2966 if (item >= 0) p_ptr->total_weight += (o_ptr->weight - weight);
2970 /* Something happened */
2976 static bool item_tester_hook_identify_fully(object_type *o_ptr)
2978 return (bool)(!object_is_known(o_ptr) || !(o_ptr->ident & IDENT_MENTAL));
2981 static bool item_tester_hook_identify_fully_weapon_armour(object_type *o_ptr)
2983 if (!item_tester_hook_identify_fully(o_ptr))
2985 return object_is_weapon_armour_ammo(o_ptr);
2989 * Fully "identify" an object in the inventory -BEN-
2990 * This routine returns TRUE if an item was identified.
2992 bool identify_fully(bool only_equip)
2996 char o_name[MAX_NLEN];
3000 item_tester_no_ryoute = TRUE;
3002 item_tester_hook = item_tester_hook_identify_fully_weapon_armour;
3004 item_tester_hook = item_tester_hook_identify_fully;
3006 if (!can_get_item())
3009 item_tester_hook = object_is_weapon_armour_ammo;
3011 item_tester_hook = NULL;
3016 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò´ÕÄꤷ¤Þ¤¹¤«? ";
3017 s = "´ÕÄꤹ¤ë¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
3019 q = "Identify which item? ";
3020 s = "You have nothing to identify.";
3023 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
3025 /* Get the item (in the pack) */
3028 o_ptr = &inventory[item];
3031 /* Get the item (on the floor) */
3034 o_ptr = &o_list[0 - item];
3038 old_known = identify_item(o_ptr);
3040 /* Mark the item as fully known */
3041 o_ptr->ident |= (IDENT_MENTAL);
3047 object_desc(o_name, o_ptr, 0);
3050 if (item >= INVEN_RARM)
3053 msg_format("%^s: %s(%c)¡£", describe_use(item), o_name, index_to_label(item));
3055 msg_format("%^s: %s (%c).", describe_use(item), o_name, index_to_label(item));
3063 msg_format("¥¶¥Ã¥¯Ãæ: %s(%c)¡£", o_name, index_to_label(item));
3065 msg_format("In your pack: %s (%c).", o_name, index_to_label(item));
3071 msg_format("¾²¾å: %s¡£", o_name);
3073 msg_format("On the ground: %s.", o_name);
3077 /* Describe it fully */
3078 (void)screen_object(o_ptr, TRUE);
3080 /* Auto-inscription/destroy */
3081 autopick_alter_item(item, (bool)(destroy_identify && !old_known));
3091 * Hook for "get_item()". Determine if something is rechargable.
3093 bool item_tester_hook_recharge(object_type *o_ptr)
3095 /* Recharge staffs */
3096 if (o_ptr->tval == TV_STAFF) return (TRUE);
3098 /* Recharge wands */
3099 if (o_ptr->tval == TV_WAND) return (TRUE);
3101 /* Hack -- Recharge rods */
3102 if (o_ptr->tval == TV_ROD) return (TRUE);
3110 * Recharge a wand/staff/rod from the pack or on the floor.
3111 * This function has been rewritten in Oangband and ZAngband.
3113 * Sorcery/Arcane -- Recharge --> recharge(plev * 4)
3114 * Chaos -- Arcane Binding --> recharge(90)
3116 * Scroll of recharging --> recharge(130)
3117 * Artifact activation/Thingol --> recharge(130)
3119 * It is harder to recharge high level, and highly charged wands,
3120 * staffs, and rods. The more wands in a stack, the more easily and
3121 * strongly they recharge. Staffs, however, each get fewer charges if
3124 * XXX XXX XXX Beware of "sliding index errors".
3126 bool recharge(int power)
3129 int recharge_strength, recharge_amount;
3138 char o_name[MAX_NLEN];
3140 /* Only accept legal items */
3141 item_tester_hook = item_tester_hook_recharge;
3145 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ËËâÎϤò½¼Å¶¤·¤Þ¤¹¤«? ";
3146 s = "ËâÎϤò½¼Å¶¤¹¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
3148 q = "Recharge which item? ";
3149 s = "You have nothing to recharge.";
3152 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return (FALSE);
3154 /* Get the item (in the pack) */
3157 o_ptr = &inventory[item];
3160 /* Get the item (on the floor) */
3163 o_ptr = &o_list[0 - item];
3166 /* Get the object kind. */
3167 k_ptr = &k_info[o_ptr->k_idx];
3169 /* Extract the object "level" */
3170 lev = k_info[o_ptr->k_idx].level;
3173 /* Recharge a rod */
3174 if (o_ptr->tval == TV_ROD)
3176 /* Extract a recharge strength by comparing object level to power. */
3177 recharge_strength = ((power > lev/2) ? (power - lev/2) : 0) / 5;
3181 if (one_in_(recharge_strength))
3183 /* Activate the failure code. */
3190 /* Recharge amount */
3191 recharge_amount = (power * damroll(3, 2));
3193 /* Recharge by that amount */
3194 if (o_ptr->timeout > recharge_amount)
3195 o_ptr->timeout -= recharge_amount;
3202 /* Recharge wand/staff */
3205 /* Extract a recharge strength by comparing object level to power.
3206 * Divide up a stack of wands' charges to calculate charge penalty.
3208 if ((o_ptr->tval == TV_WAND) && (o_ptr->number > 1))
3209 recharge_strength = (100 + power - lev -
3210 (8 * o_ptr->pval / o_ptr->number)) / 15;
3212 /* All staffs, unstacked wands. */
3213 else recharge_strength = (100 + power - lev -
3214 (8 * o_ptr->pval)) / 15;
3217 if (recharge_strength < 0) recharge_strength = 0;
3220 if (one_in_(recharge_strength))
3222 /* Activate the failure code. */
3226 /* If the spell didn't backfire, recharge the wand or staff. */
3229 /* Recharge based on the standard number of charges. */
3230 recharge_amount = randint1(1 + k_ptr->pval / 2);
3232 /* Multiple wands in a stack increase recharging somewhat. */
3233 if ((o_ptr->tval == TV_WAND) && (o_ptr->number > 1))
3236 (randint1(recharge_amount * (o_ptr->number - 1))) / 2;
3237 if (recharge_amount < 1) recharge_amount = 1;
3238 if (recharge_amount > 12) recharge_amount = 12;
3241 /* But each staff in a stack gets fewer additional charges,
3242 * although always at least one.
3244 if ((o_ptr->tval == TV_STAFF) && (o_ptr->number > 1))
3246 recharge_amount /= o_ptr->number;
3247 if (recharge_amount < 1) recharge_amount = 1;
3250 /* Recharge the wand or staff. */
3251 o_ptr->pval += recharge_amount;
3254 /* Hack -- we no longer "know" the item */
3255 o_ptr->ident &= ~(IDENT_KNOWN);
3257 /* Hack -- we no longer think the item is empty */
3258 o_ptr->ident &= ~(IDENT_EMPTY);
3263 /* Inflict the penalties for failing a recharge. */
3266 /* Artifacts are never destroyed. */
3267 if (object_is_fixed_artifact(o_ptr))
3269 object_desc(o_name, o_ptr, OD_NAME_ONLY);
3271 msg_format("ËâÎϤ¬µÕή¤·¤¿¡ª%s¤Ï´°Á´¤ËËâÎϤò¼º¤Ã¤¿¡£", o_name);
3273 msg_format("The recharging backfires - %s is completely drained!", o_name);
3277 /* Artifact rods. */
3278 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout < 10000))
3279 o_ptr->timeout = (o_ptr->timeout + 100) * 2;
3281 /* Artifact wands and staffs. */
3282 else if ((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_STAFF))
3287 /* Get the object description */
3288 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
3290 /*** Determine Seriousness of Failure ***/
3292 /* Mages recharge objects more safely. */
3293 if (p_ptr->pclass == CLASS_MAGE || p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER || p_ptr->pclass == CLASS_MAGIC_EATER || p_ptr->pclass == CLASS_BLUE_MAGE)
3295 /* 10% chance to blow up one rod, otherwise draining. */
3296 if (o_ptr->tval == TV_ROD)
3298 if (one_in_(10)) fail_type = 2;
3301 /* 75% chance to blow up one wand, otherwise draining. */
3302 else if (o_ptr->tval == TV_WAND)
3304 if (!one_in_(3)) fail_type = 2;
3307 /* 50% chance to blow up one staff, otherwise no effect. */
3308 else if (o_ptr->tval == TV_STAFF)
3310 if (one_in_(2)) fail_type = 2;
3315 /* All other classes get no special favors. */
3318 /* 33% chance to blow up one rod, otherwise draining. */
3319 if (o_ptr->tval == TV_ROD)
3321 if (one_in_(3)) fail_type = 2;
3324 /* 20% chance of the entire stack, else destroy one wand. */
3325 else if (o_ptr->tval == TV_WAND)
3327 if (one_in_(5)) fail_type = 3;
3330 /* Blow up one staff. */
3331 else if (o_ptr->tval == TV_STAFF)
3337 /*** Apply draining and destruction. ***/
3339 /* Drain object or stack of objects. */
3342 if (o_ptr->tval == TV_ROD)
3345 msg_print("ËâÎϤ¬µÕÊ®¼Í¤·¤Æ¡¢¥í¥Ã¥É¤«¤é¤µ¤é¤ËËâÎϤòµÛ¤¤¼è¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
3347 msg_print("The recharge backfires, draining the rod further!");
3350 if (o_ptr->timeout < 10000)
3351 o_ptr->timeout = (o_ptr->timeout + 100) * 2;
3353 else if (o_ptr->tval == TV_WAND)
3356 msg_format("%s¤ÏÇË»¤òÌȤ줿¤¬¡¢ËâÎϤ¬Á´¤Æ¼º¤ï¤ì¤¿¡£", o_name);
3358 msg_format("You save your %s from destruction, but all charges are lost.", o_name);
3363 /* Staffs aren't drained. */
3366 /* Destroy an object or one in a stack of objects. */
3369 if (o_ptr->number > 1)
3371 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬°ìËܲõ¤ì¤¿¡ª", o_name);
3373 msg_format("Wild magic consumes one of your %s!", o_name);
3378 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²õ¤ì¤¿¡ª", o_name);
3380 msg_format("Wild magic consumes your %s!", o_name);
3384 /* Reduce rod stack maximum timeout, drain wands. */
3385 if (o_ptr->tval == TV_ROD) o_ptr->timeout = (o_ptr->number - 1) * k_ptr->pval;
3386 if (o_ptr->tval == TV_WAND) o_ptr->pval = 0;
3388 /* Reduce and describe inventory */
3391 inven_item_increase(item, -1);
3392 inven_item_describe(item);
3393 inven_item_optimize(item);
3396 /* Reduce and describe floor item */
3399 floor_item_increase(0 - item, -1);
3400 floor_item_describe(0 - item);
3401 floor_item_optimize(0 - item);
3405 /* Destroy all members of a stack of objects. */
3408 if (o_ptr->number > 1)
3410 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬Á´¤Æ²õ¤ì¤¿¡ª", o_name);
3412 msg_format("Wild magic consumes all your %s!", o_name);
3417 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²õ¤ì¤¿¡ª", o_name);
3419 msg_format("Wild magic consumes your %s!", o_name);
3424 /* Reduce and describe inventory */
3427 inven_item_increase(item, -999);
3428 inven_item_describe(item);
3429 inven_item_optimize(item);
3432 /* Reduce and describe floor item */
3435 floor_item_increase(0 - item, -999);
3436 floor_item_describe(0 - item);
3437 floor_item_optimize(0 - item);
3443 /* Combine / Reorder the pack (later) */
3444 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
3447 p_ptr->window |= (PW_INVEN);
3449 /* Something was done */
3457 bool bless_weapon(void)
3461 u32b flgs[TR_FLAG_SIZE];
3462 char o_name[MAX_NLEN];
3465 item_tester_no_ryoute = TRUE;
3467 /* Bless only weapons */
3468 item_tester_hook = object_is_weapon;
3472 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò½ËÊ¡¤·¤Þ¤¹¤«¡©";
3473 s = "½ËÊ¡¤Ç¤¤ëÉð´ï¤¬¤¢¤ê¤Þ¤»¤ó¡£";
3475 q = "Bless which weapon? ";
3476 s = "You have weapon to bless.";
3479 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR)))
3482 /* Get the item (in the pack) */
3485 o_ptr = &inventory[item];
3488 /* Get the item (on the floor) */
3491 o_ptr = &o_list[0 - item];
3496 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
3498 /* Extract the flags */
3499 object_flags(o_ptr, flgs);
3501 if (object_is_cursed(o_ptr))
3503 if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && (randint1(100) < 33)) ||
3504 (o_ptr->curse_flags & TRC_PERMA_CURSE))
3507 msg_format("%s¤òʤ¤¦¹õ¤¤¥ª¡¼¥é¤Ï½ËÊ¡¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
3510 msg_format("The black aura on %s %s disrupts the blessing!",
3511 ((item >= 0) ? "your" : "the"), o_name);
3518 msg_format("%s ¤«¤é¼Ù°¤Ê¥ª¡¼¥é¤¬¾Ã¤¨¤¿¡£",
3521 msg_format("A malignant aura leaves %s %s.",
3522 ((item >= 0) ? "your" : "the"), o_name);
3527 o_ptr->curse_flags = 0L;
3529 /* Hack -- Assume felt */
3530 o_ptr->ident |= (IDENT_SENSE);
3533 o_ptr->feeling = FEEL_NONE;
3535 /* Recalculate the bonuses */
3536 p_ptr->update |= (PU_BONUS);
3539 p_ptr->window |= (PW_EQUIP);
3543 * Next, we try to bless it. Artifacts have a 1/3 chance of
3544 * being blessed, otherwise, the operation simply disenchants
3545 * them, godly power negating the magic. Ok, the explanation
3546 * is silly, but otherwise priests would always bless every
3547 * artifact weapon they find. Ego weapons and normal weapons
3548 * can be blessed automatically.
3550 if (have_flag(flgs, TR_BLESSED))
3553 msg_format("%s ¤Ï´û¤Ë½ËÊ¡¤µ¤ì¤Æ¤¤¤ë¡£",
3556 msg_format("%s %s %s blessed already.",
3557 ((item >= 0) ? "Your" : "The"), o_name,
3558 ((o_ptr->number > 1) ? "were" : "was"));
3564 if (!(object_is_artifact(o_ptr) || object_is_ego(o_ptr)) || one_in_(3))
3568 msg_format("%s¤Ïµ±¤¤¤¿¡ª",
3571 msg_format("%s %s shine%s!",
3572 ((item >= 0) ? "Your" : "The"), o_name,
3573 ((o_ptr->number > 1) ? "" : "s"));
3576 add_flag(o_ptr->art_flags, TR_BLESSED);
3577 o_ptr->discount = 99;
3581 bool dis_happened = FALSE;
3584 msg_print("¤½¤ÎÉð´ï¤Ï½ËÊ¡¤ò·ù¤Ã¤Æ¤¤¤ë¡ª");
3586 msg_print("The weapon resists your blessing!");
3590 /* Disenchant tohit */
3591 if (o_ptr->to_h > 0)
3594 dis_happened = TRUE;
3597 if ((o_ptr->to_h > 5) && (randint0(100) < 33)) o_ptr->to_h--;
3599 /* Disenchant todam */
3600 if (o_ptr->to_d > 0)
3603 dis_happened = TRUE;
3606 if ((o_ptr->to_d > 5) && (randint0(100) < 33)) o_ptr->to_d--;
3608 /* Disenchant toac */
3609 if (o_ptr->to_a > 0)
3612 dis_happened = TRUE;
3615 if ((o_ptr->to_a > 5) && (randint0(100) < 33)) o_ptr->to_a--;
3620 msg_print("¼þ°Ï¤¬ËÞÍǤÊÊ·°Ïµ¤¤ÇËþ¤Á¤¿...");
3622 msg_print("There is a static feeling in the air...");
3626 msg_format("%s ¤ÏÎô²½¤·¤¿¡ª",
3629 msg_format("%s %s %s disenchanted!",
3630 ((item >= 0) ? "Your" : "The"), o_name,
3631 ((o_ptr->number > 1) ? "were" : "was"));
3637 /* Recalculate bonuses */
3638 p_ptr->update |= (PU_BONUS);
3641 p_ptr->window |= (PW_EQUIP | PW_PLAYER);
3652 bool pulish_shield(void)
3656 u32b flgs[TR_FLAG_SIZE];
3657 char o_name[MAX_NLEN];
3660 item_tester_no_ryoute = TRUE;
3661 /* Assume enchant weapon */
3662 item_tester_tval = TV_SHIELD;
3666 q = "¤É¤Î½â¤òËᤤޤ¹¤«¡©";
3667 s = "Ë᤯½â¤¬¤¢¤ê¤Þ¤»¤ó¡£";
3669 q = "Pulish which weapon? ";
3670 s = "You have weapon to pulish.";
3673 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR)))
3676 /* Get the item (in the pack) */
3679 o_ptr = &inventory[item];
3682 /* Get the item (on the floor) */
3685 o_ptr = &o_list[0 - item];
3690 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
3692 /* Extract the flags */
3693 object_flags(o_ptr, flgs);
3695 if (o_ptr->k_idx && !object_is_artifact(o_ptr) && !object_is_ego(o_ptr) &&
3696 !object_is_cursed(o_ptr) && (o_ptr->sval != SV_MIRROR_SHIELD))
3699 msg_format("%s¤Ïµ±¤¤¤¿¡ª", o_name);
3701 msg_format("%s %s shine%s!",
3702 ((item >= 0) ? "Your" : "The"), o_name,
3703 ((o_ptr->number > 1) ? "" : "s"));
3705 o_ptr->name2 = EGO_REFLECTION;
3706 enchant(o_ptr, randint0(3) + 4, ENCH_TOAC);
3708 o_ptr->discount = 99;
3709 chg_virtue(V_ENCHANT, 2);
3715 if (flush_failure) flush();
3718 msg_print("¼ºÇÔ¤·¤¿¡£");
3720 msg_print("Failed.");
3723 chg_virtue(V_ENCHANT, -2);
3732 * Potions "smash open" and cause an area effect when
3733 * (1) they are shattered while in the player's inventory,
3734 * due to cold (etc) attacks;
3735 * (2) they are thrown at a monster, or obstacle;
3736 * (3) they are shattered by a "cold ball" or other such spell
3737 * while lying on the floor.
3740 * who --- who caused the potion to shatter (0=player)
3741 * potions that smash on the floor are assumed to
3742 * be caused by no-one (who = 1), as are those that
3743 * shatter inside the player inventory.
3744 * (Not anymore -- I changed this; TY)
3745 * y, x --- coordinates of the potion (or player if
3746 * the potion was in her inventory);
3747 * o_ptr --- pointer to the potion object.
3749 bool potion_smash_effect(int who, int y, int x, int k_idx)
3756 object_kind *k_ptr = &k_info[k_idx];
3758 switch (k_ptr->sval)
3760 case SV_POTION_SALT_WATER:
3761 case SV_POTION_SLIME_MOLD:
3762 case SV_POTION_LOSE_MEMORIES:
3763 case SV_POTION_DEC_STR:
3764 case SV_POTION_DEC_INT:
3765 case SV_POTION_DEC_WIS:
3766 case SV_POTION_DEC_DEX:
3767 case SV_POTION_DEC_CON:
3768 case SV_POTION_DEC_CHR:
3769 case SV_POTION_WATER: /* perhaps a 'water' attack? */
3770 case SV_POTION_APPLE_JUICE:
3773 case SV_POTION_INFRAVISION:
3774 case SV_POTION_DETECT_INVIS:
3775 case SV_POTION_SLOW_POISON:
3776 case SV_POTION_CURE_POISON:
3777 case SV_POTION_BOLDNESS:
3778 case SV_POTION_RESIST_HEAT:
3779 case SV_POTION_RESIST_COLD:
3780 case SV_POTION_HEROISM:
3781 case SV_POTION_BESERK_STRENGTH:
3782 case SV_POTION_RES_STR:
3783 case SV_POTION_RES_INT:
3784 case SV_POTION_RES_WIS:
3785 case SV_POTION_RES_DEX:
3786 case SV_POTION_RES_CON:
3787 case SV_POTION_RES_CHR:
3788 case SV_POTION_INC_STR:
3789 case SV_POTION_INC_INT:
3790 case SV_POTION_INC_WIS:
3791 case SV_POTION_INC_DEX:
3792 case SV_POTION_INC_CON:
3793 case SV_POTION_INC_CHR:
3794 case SV_POTION_AUGMENTATION:
3795 case SV_POTION_ENLIGHTENMENT:
3796 case SV_POTION_STAR_ENLIGHTENMENT:
3797 case SV_POTION_SELF_KNOWLEDGE:
3798 case SV_POTION_EXPERIENCE:
3799 case SV_POTION_RESISTANCE:
3800 case SV_POTION_INVULNERABILITY:
3801 case SV_POTION_NEW_LIFE:
3802 /* All of the above potions have no effect when shattered */
3804 case SV_POTION_SLOWNESS:
3809 case SV_POTION_POISON:
3814 case SV_POTION_BLINDNESS:
3818 case SV_POTION_CONFUSION: /* Booze */
3822 case SV_POTION_SLEEP:
3826 case SV_POTION_RUINATION:
3827 case SV_POTION_DETONATIONS:
3829 dam = damroll(25, 25);
3832 case SV_POTION_DEATH:
3833 dt = GF_DEATH_RAY; /* !! */
3834 dam = k_ptr->level * 10;
3838 case SV_POTION_SPEED:
3841 case SV_POTION_CURE_LIGHT:
3843 dam = damroll(2, 3);
3845 case SV_POTION_CURE_SERIOUS:
3847 dam = damroll(4, 3);
3849 case SV_POTION_CURE_CRITICAL:
3850 case SV_POTION_CURING:
3852 dam = damroll(6, 3);
3854 case SV_POTION_HEALING:
3856 dam = damroll(10, 10);
3858 case SV_POTION_RESTORE_EXP:
3863 case SV_POTION_LIFE:
3865 dam = damroll(50, 50);
3868 case SV_POTION_STAR_HEALING:
3870 dam = damroll(50, 50);
3873 case SV_POTION_RESTORE_MANA: /* MANA */
3875 dam = damroll(10, 10);
3882 (void)project(who, radius, y, x, dam, dt,
3883 (PROJECT_JUMP | PROJECT_ITEM | PROJECT_KILL), -1);
3885 /* XXX those potions that explode need to become "known" */
3891 * Hack -- Display all known spells in a window
3893 * XXX XXX XXX Need to analyze size of the window.
3895 * XXX XXX XXX Need more color coding.
3897 void display_spell_list(void)
3910 /* They have too many spells to list */
3911 if (p_ptr->pclass == CLASS_SORCERER) return;
3912 if (p_ptr->pclass == CLASS_RED_MAGE) return;
3914 /* mind.c type classes */
3915 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
3916 (p_ptr->pclass == CLASS_BERSERKER) ||
3917 (p_ptr->pclass == CLASS_NINJA) ||
3918 (p_ptr->pclass == CLASS_MIRROR_MASTER) ||
3919 (p_ptr->pclass == CLASS_FORCETRAINER))
3925 int plev = p_ptr->lev;
3931 bool use_hp = FALSE;
3933 /* Display a list of spells */
3936 put_str("̾Á°", y, x + 5);
3937 put_str("Lv MP ¼ºÎ¨ ¸ú²Ì", y, x + 35);
3939 put_str("Name", y, x + 5);
3940 put_str("Lv Mana Fail Info", y, x + 35);
3943 switch(p_ptr->pclass)
3945 case CLASS_MINDCRAFTER: use_mind = MIND_MINDCRAFTER;break;
3946 case CLASS_FORCETRAINER: use_mind = MIND_KI;break;
3947 case CLASS_BERSERKER: use_mind = MIND_BERSERKER; use_hp = TRUE; break;
3948 case CLASS_MIRROR_MASTER: use_mind = MIND_MIRROR_MASTER; break;
3949 case CLASS_NINJA: use_mind = MIND_NINJUTSU; use_hp = TRUE; break;
3950 default: use_mind = 0;break;
3953 /* Dump the spells */
3954 for (i = 0; i < MAX_MIND_POWERS; i++)
3956 byte a = TERM_WHITE;
3958 /* Access the available spell */
3959 spell = mind_powers[use_mind].info[i];
3960 if (spell.min_lev > plev) break;
3962 /* Get the failure rate */
3963 chance = spell.fail;
3965 /* Reduce failure rate by "effective" level adjustment */
3966 chance -= 3 * (p_ptr->lev - spell.min_lev);
3968 /* Reduce failure rate by INT/WIS adjustment */
3969 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
3973 /* Not enough mana to cast */
3974 if (spell.mana_cost > p_ptr->csp)
3976 chance += 5 * (spell.mana_cost - p_ptr->csp);
3982 /* Not enough hp to cast */
3983 if (spell.mana_cost > p_ptr->chp)
3990 /* Extract the minimum failure rate */
3991 minfail = adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]];
3993 /* Minimum failure rate */
3994 if (chance < minfail) chance = minfail;
3996 /* Stunning makes spells harder */
3997 if (p_ptr->stun > 50) chance += 25;
3998 else if (p_ptr->stun) chance += 15;
4000 /* Always a 5 percent chance of working */
4001 if (chance > 95) chance = 95;
4004 mindcraft_info(comment, use_mind, i);
4006 /* Dump the spell */
4007 sprintf(psi_desc, " %c) %-30s%2d %4d %3d%%%s",
4009 spell.min_lev, spell.mana_cost, chance, comment);
4011 Term_putstr(x, y + i + 1, -1, a, psi_desc);
4016 /* Cannot read spellbooks */
4017 if (REALM_NONE == p_ptr->realm1) return;
4019 /* Normal spellcaster with books */
4022 for (j = 0; j < ((p_ptr->realm2 > REALM_NONE) ? 2 : 1); j++)
4026 /* Reset vertical */
4029 /* Vertical location */
4030 y = (j < 3) ? 0 : (m[j - 3] + 2);
4032 /* Horizontal location */
4036 for (i = 0; i < 32; i++)
4038 byte a = TERM_WHITE;
4040 /* Access the spell */
4041 if (!is_magic((j < 1) ? p_ptr->realm1 : p_ptr->realm2))
4043 s_ptr = &technic_info[((j < 1) ? p_ptr->realm1 : p_ptr->realm2) - MIN_TECHNIC][i % 32];
4047 s_ptr = &mp_ptr->info[((j < 1) ? p_ptr->realm1 : p_ptr->realm2) - 1][i % 32];
4050 strcpy(name, do_spell((j < 1) ? p_ptr->realm1 : p_ptr->realm2, i % 32, SPELL_NAME));
4053 if (s_ptr->slevel >= 99)
4057 strcpy(name, "(ȽÆÉÉÔǽ)");
4059 strcpy(name, "(illegible)");
4069 ((p_ptr->spell_forgotten1 & (1L << i))) :
4070 ((p_ptr->spell_forgotten2 & (1L << (i % 32)))))
4077 else if (!((j < 1) ?
4078 (p_ptr->spell_learned1 & (1L << i)) :
4079 (p_ptr->spell_learned2 & (1L << (i % 32)))))
4086 else if (!((j < 1) ?
4087 (p_ptr->spell_worked1 & (1L << i)) :
4088 (p_ptr->spell_worked2 & (1L << (i % 32)))))
4094 /* Dump the spell --(-- */
4095 sprintf(out_val, "%c/%c) %-20.20s",
4096 I2A(n / 8), I2A(n % 8), name);
4101 /* Dump onto the window */
4102 Term_putstr(x, m[j], -1, a, out_val);
4112 * Returns experience of a spell
4114 s16b experience_of_spell(int spell, int use_realm)
4116 if (p_ptr->pclass == CLASS_SORCERER) return SPELL_EXP_MASTER;
4117 else if (p_ptr->pclass == CLASS_RED_MAGE) return SPELL_EXP_SKILLED;
4118 else if (use_realm == p_ptr->realm1) return p_ptr->spell_exp[spell];
4119 else if (use_realm == p_ptr->realm2) return p_ptr->spell_exp[spell + 32];
4125 * Modify mana consumption rate using spell exp and p_ptr->dec_mana
4127 int mod_need_mana(int need_mana, int spell, int realm)
4129 #define MANA_CONST 2400
4131 #define DEC_MANA_DIV 3
4134 if ((realm > REALM_NONE) && (realm <= MAX_REALM))
4137 * need_mana defaults if spell exp equals SPELL_EXP_EXPERT and !p_ptr->dec_mana.
4138 * MANA_CONST is used to calculate need_mana effected from spell proficiency.
4140 need_mana = need_mana * (MANA_CONST + SPELL_EXP_EXPERT - experience_of_spell(spell, realm)) + (MANA_CONST - 1);
4141 need_mana *= p_ptr->dec_mana ? DEC_MANA_DIV : MANA_DIV;
4142 need_mana /= MANA_CONST * MANA_DIV;
4143 if (need_mana < 1) need_mana = 1;
4146 /* Non-realm magic */
4149 if (p_ptr->dec_mana) need_mana = (need_mana + 1) * DEC_MANA_DIV / MANA_DIV;
4161 * Modify spell fail rate
4162 * Using p_ptr->to_m_chance, p_ptr->dec_mana, p_ptr->easy_spell and p_ptr->heavy_spell
4164 int mod_spell_chance_1(int chance)
4166 chance += p_ptr->to_m_chance;
4168 if (p_ptr->heavy_spell) chance += 20;
4170 if (p_ptr->dec_mana && p_ptr->easy_spell) chance -= 4;
4171 else if (p_ptr->easy_spell) chance -= 3;
4172 else if (p_ptr->dec_mana) chance -= 2;
4179 * Modify spell fail rate (as "suffix" process)
4180 * Using p_ptr->dec_mana, p_ptr->easy_spell and p_ptr->heavy_spell
4181 * Note: variable "chance" cannot be negative.
4183 int mod_spell_chance_2(int chance)
4185 if (p_ptr->dec_mana) chance--;
4187 if (p_ptr->heavy_spell) chance += 5;
4189 return MAX(chance, 0);
4194 * Returns spell chance of failure for spell -RAK-
4196 s16b spell_chance(int spell, int use_realm)
4198 int chance, minfail;
4201 int penalty = (mp_ptr->spell_stat == A_WIS) ? 10 : 4;
4204 /* Paranoia -- must be literate */
4205 if (!mp_ptr->spell_book) return (100);
4207 if (use_realm == REALM_HISSATSU) return 0;
4209 /* Access the spell */
4210 if (!is_magic(use_realm))
4212 s_ptr = &technic_info[use_realm - MIN_TECHNIC][spell];
4216 s_ptr = &mp_ptr->info[use_realm - 1][spell];
4219 /* Extract the base spell failure rate */
4220 chance = s_ptr->sfail;
4222 /* Reduce failure rate by "effective" level adjustment */
4223 chance -= 3 * (p_ptr->lev - s_ptr->slevel);
4225 /* Reduce failure rate by INT/WIS adjustment */
4226 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
4229 chance += (MAX(r_info[m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 100 - 10, 0));
4231 /* Extract mana consumption rate */
4232 need_mana = mod_need_mana(s_ptr->smana, spell, use_realm);
4234 /* Not enough mana to cast */
4235 if (need_mana > p_ptr->csp)
4237 chance += 5 * (need_mana - p_ptr->csp);
4240 if ((use_realm != p_ptr->realm1) && ((p_ptr->pclass == CLASS_MAGE) || (p_ptr->pclass == CLASS_PRIEST))) chance += 5;
4242 /* Extract the minimum failure rate */
4243 minfail = adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]];
4246 * Non mage/priest characters never get too good
4247 * (added high mage, mindcrafter)
4249 if (mp_ptr->spell_xtra & MAGIC_FAIL_5PERCENT)
4251 if (minfail < 5) minfail = 5;
4254 /* Hack -- Priest prayer penalty for "edged" weapons -DGK */
4255 if (((p_ptr->pclass == CLASS_PRIEST) || (p_ptr->pclass == CLASS_SORCERER)) && p_ptr->icky_wield[0]) chance += 25;
4256 if (((p_ptr->pclass == CLASS_PRIEST) || (p_ptr->pclass == CLASS_SORCERER)) && p_ptr->icky_wield[1]) chance += 25;
4258 chance = mod_spell_chance_1(chance);
4260 if ((use_realm == REALM_NATURE) && ((p_ptr->align > 50) || (p_ptr->align < -50))) chance += penalty;
4261 if (((use_realm == REALM_LIFE) || (use_realm == REALM_CRUSADE)) && (p_ptr->align < -20)) chance += penalty;
4262 if (((use_realm == REALM_DEATH) || (use_realm == REALM_DAEMON)) && (p_ptr->align > 20)) chance += penalty;
4264 /* Minimum failure rate */
4265 if (chance < minfail) chance = minfail;
4267 /* Stunning makes spells harder */
4268 if (p_ptr->stun > 50) chance += 25;
4269 else if (p_ptr->stun) chance += 15;
4271 /* Always a 5 percent chance of working */
4272 if (chance > 95) chance = 95;
4274 if ((use_realm == p_ptr->realm1) || (use_realm == p_ptr->realm2)
4275 || (p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4277 s16b exp = experience_of_spell(spell, use_realm);
4278 if (exp >= SPELL_EXP_EXPERT) chance--;
4279 if (exp >= SPELL_EXP_MASTER) chance--;
4282 /* Return the chance */
4283 return mod_spell_chance_2(chance);
4289 * Determine if a spell is "okay" for the player to cast or study
4290 * The spell must be legible, not forgotten, and also, to cast,
4291 * it must be known, and to study, it must not be known.
4293 bool spell_okay(int spell, bool learned, bool study_pray, int use_realm)
4297 /* Access the spell */
4298 if (!is_magic(use_realm))
4300 s_ptr = &technic_info[use_realm - MIN_TECHNIC][spell];
4304 s_ptr = &mp_ptr->info[use_realm - 1][spell];
4307 /* Spell is illegal */
4308 if (s_ptr->slevel > p_ptr->lev) return (FALSE);
4310 /* Spell is forgotten */
4311 if ((use_realm == p_ptr->realm2) ?
4312 (p_ptr->spell_forgotten2 & (1L << spell)) :
4313 (p_ptr->spell_forgotten1 & (1L << spell)))
4319 if (p_ptr->pclass == CLASS_SORCERER) return (TRUE);
4320 if (p_ptr->pclass == CLASS_RED_MAGE) return (TRUE);
4322 /* Spell is learned */
4323 if ((use_realm == p_ptr->realm2) ?
4324 (p_ptr->spell_learned2 & (1L << spell)) :
4325 (p_ptr->spell_learned1 & (1L << spell)))
4328 return (!study_pray);
4331 /* Okay to study, not to cast */
4337 * Print a list of spells (for browsing or casting or viewing)
4339 void print_spells(int target_spell, byte *spells, int num, int y, int x, int use_realm)
4341 int i, spell, exp_level, increment = 64;
4353 if (((use_realm <= REALM_NONE) || (use_realm > MAX_REALM)) && p_ptr->wizard)
4355 msg_print("·Ù¹ð¡ª print_spell ¤¬Îΰè¤Ê¤·¤Ë¸Æ¤Ð¤ì¤¿");
4357 msg_print("Warning! print_spells called with null realm");
4361 /* Title the list */
4363 if (use_realm == REALM_HISSATSU)
4365 strcpy(buf," Lv MP");
4367 strcpy(buf," Lv SP");
4371 strcpy(buf,"½ÏÎýÅÙ Lv MP ¼ºÎ¨ ¸ú²Ì");
4373 strcpy(buf,"Profic Lv SP Fail Effect");
4377 put_str("̾Á°", y, x + 5);
4378 put_str(buf, y, x + 29);
4380 put_str("Name", y, x + 5);
4381 put_str(buf, y, x + 29);
4384 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE)) increment = 0;
4385 else if (use_realm == p_ptr->realm1) increment = 0;
4386 else if (use_realm == p_ptr->realm2) increment = 32;
4388 /* Dump the spells */
4389 for (i = 0; i < num; i++)
4391 /* Access the spell */
4394 /* Access the spell */
4395 if (!is_magic(use_realm))
4397 s_ptr = &technic_info[use_realm - MIN_TECHNIC][spell];
4401 s_ptr = &mp_ptr->info[use_realm - 1][spell];
4404 if (use_realm == REALM_HISSATSU)
4405 need_mana = s_ptr->smana;
4408 s16b exp = experience_of_spell(spell, use_realm);
4410 /* Extract mana consumption rate */
4411 need_mana = mod_need_mana(s_ptr->smana, spell, use_realm);
4413 if ((increment == 64) || (s_ptr->slevel >= 99)) exp_level = EXP_LEVEL_UNSKILLED;
4414 else exp_level = spell_exp_level(exp);
4417 if (!increment && (exp_level == EXP_LEVEL_MASTER)) max = TRUE;
4418 else if ((increment == 32) && (exp_level >= EXP_LEVEL_EXPERT)) max = TRUE;
4419 else if (s_ptr->slevel >= 99) max = TRUE;
4420 else if ((p_ptr->pclass == CLASS_RED_MAGE) && (exp_level >= EXP_LEVEL_SKILLED)) max = TRUE;
4422 strncpy(ryakuji, exp_level_str[exp_level], 4);
4427 if (use_menu && target_spell)
4429 if (i == (target_spell-1))
4431 strcpy(out_val, " ¡Õ ");
4433 strcpy(out_val, " > ");
4436 strcpy(out_val, " ");
4438 else sprintf(out_val, " %c) ", I2A(i));
4439 /* Skip illegible spells */
4440 if (s_ptr->slevel >= 99)
4443 strcat(out_val, format("%-30s", "(ȽÆÉÉÔǽ)"));
4445 strcat(out_val, format("%-30s", "(illegible)"));
4448 c_prt(TERM_L_DARK, out_val, y + i + 1, x);
4452 /* XXX XXX Could label spells above the players level */
4454 /* Get extra info */
4455 strcpy(info, do_spell(use_realm, spell, SPELL_INFO));
4460 /* Assume spell is known and tried */
4461 line_attr = TERM_WHITE;
4463 /* Analyze the spell */
4464 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4466 if (s_ptr->slevel > p_ptr->max_plv)
4471 comment = "unknown";
4474 line_attr = TERM_L_BLUE;
4476 else if (s_ptr->slevel > p_ptr->lev)
4481 comment = "forgotten";
4484 line_attr = TERM_YELLOW;
4487 else if ((use_realm != p_ptr->realm1) && (use_realm != p_ptr->realm2))
4492 comment = "unknown";
4495 line_attr = TERM_L_BLUE;
4497 else if ((use_realm == p_ptr->realm1) ?
4498 ((p_ptr->spell_forgotten1 & (1L << spell))) :
4499 ((p_ptr->spell_forgotten2 & (1L << spell))))
4504 comment = "forgotten";
4507 line_attr = TERM_YELLOW;
4509 else if (!((use_realm == p_ptr->realm1) ?
4510 (p_ptr->spell_learned1 & (1L << spell)) :
4511 (p_ptr->spell_learned2 & (1L << spell))))
4516 comment = "unknown";
4519 line_attr = TERM_L_BLUE;
4521 else if (!((use_realm == p_ptr->realm1) ?
4522 (p_ptr->spell_worked1 & (1L << spell)) :
4523 (p_ptr->spell_worked2 & (1L << spell))))
4528 comment = "untried";
4531 line_attr = TERM_L_GREEN;
4534 /* Dump the spell --(-- */
4535 if (use_realm == REALM_HISSATSU)
4537 strcat(out_val, format("%-25s %2d %4d",
4538 do_spell(use_realm, spell, SPELL_NAME), /* realm, spell */
4539 s_ptr->slevel, need_mana));
4543 strcat(out_val, format("%-25s%c%-4s %2d %4d %3d%% %s",
4544 do_spell(use_realm, spell, SPELL_NAME), /* realm, spell */
4545 (max ? '!' : ' '), ryakuji,
4546 s_ptr->slevel, need_mana, spell_chance(spell, use_realm), comment));
4548 c_prt(line_attr, out_val, y + i + 1, x);
4551 /* Clear the bottom line */
4552 prt("", y + i + 1, x);
4557 * Note that amulets, rods, and high-level spell books are immune
4558 * to "inventory damage" of any kind. Also sling ammo and shovels.
4563 * Does a given class of objects (usually) hate acid?
4564 * Note that acid can either melt or corrode something.
4566 bool hates_acid(object_type *o_ptr)
4568 /* Analyze the type */
4569 switch (o_ptr->tval)
4571 /* Wearable items */
4591 /* Staffs/Scrolls are wood/paper */
4604 /* Junk is useless */
4618 * Does a given object (usually) hate electricity?
4620 bool hates_elec(object_type *o_ptr)
4622 switch (o_ptr->tval)
4636 * Does a given object (usually) hate fire?
4637 * Hafted/Polearm weapons have wooden shafts.
4638 * Arrows/Bows are mostly wooden.
4640 bool hates_fire(object_type *o_ptr)
4642 /* Analyze the type */
4643 switch (o_ptr->tval)
4661 case TV_SORCERY_BOOK:
4662 case TV_NATURE_BOOK:
4666 case TV_ARCANE_BOOK:
4668 case TV_DAEMON_BOOK:
4669 case TV_CRUSADE_BOOK:
4671 case TV_HISSATSU_BOOK:
4682 /* Staffs/Scrolls burn */
4695 * Does a given object (usually) hate cold?
4697 bool hates_cold(object_type *o_ptr)
4699 switch (o_ptr->tval)
4716 int set_acid_destroy(object_type *o_ptr)
4718 u32b flgs[TR_FLAG_SIZE];
4719 if (!hates_acid(o_ptr)) return (FALSE);
4720 object_flags(o_ptr, flgs);
4721 if (have_flag(flgs, TR_IGNORE_ACID)) return (FALSE);
4729 int set_elec_destroy(object_type *o_ptr)
4731 u32b flgs[TR_FLAG_SIZE];
4732 if (!hates_elec(o_ptr)) return (FALSE);
4733 object_flags(o_ptr, flgs);
4734 if (have_flag(flgs, TR_IGNORE_ELEC)) return (FALSE);
4742 int set_fire_destroy(object_type *o_ptr)
4744 u32b flgs[TR_FLAG_SIZE];
4745 if (!hates_fire(o_ptr)) return (FALSE);
4746 object_flags(o_ptr, flgs);
4747 if (have_flag(flgs, TR_IGNORE_FIRE)) return (FALSE);
4755 int set_cold_destroy(object_type *o_ptr)
4757 u32b flgs[TR_FLAG_SIZE];
4758 if (!hates_cold(o_ptr)) return (FALSE);
4759 object_flags(o_ptr, flgs);
4760 if (have_flag(flgs, TR_IGNORE_COLD)) return (FALSE);
4766 * Destroys a type of item on a given percent chance
4767 * Note that missiles are no longer necessarily all destroyed
4768 * Destruction taken from "melee.c" code for "stealing".
4769 * New-style wands and rods handled correctly. -LM-
4770 * Returns number of items destroyed.
4772 int inven_damage(inven_func typ, int perc)
4776 char o_name[MAX_NLEN];
4778 /* Multishadow effects is determined by turn */
4779 if( p_ptr->multishadow && (turn & 1) )return 0;
4781 if (p_ptr->inside_arena) return 0;
4783 /* Count the casualties */
4786 /* Scan through the slots backwards */
4787 for (i = 0; i < INVEN_PACK; i++)
4789 o_ptr = &inventory[i];
4791 /* Skip non-objects */
4792 if (!o_ptr->k_idx) continue;
4794 /* Hack -- for now, skip artifacts */
4795 if (object_is_artifact(o_ptr)) continue;
4797 /* Give this item slot a shot at death */
4800 /* Count the casualties */
4801 for (amt = j = 0; j < o_ptr->number; ++j)
4803 if (randint0(100) < perc) amt++;
4806 /* Some casualities */
4809 /* Get a description */
4810 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
4814 msg_format("%s(%c)¤¬%s²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª",
4816 msg_format("%sour %s (%c) %s destroyed!",
4820 o_name, index_to_label(i),
4821 ((o_ptr->number > 1) ?
4822 ((amt == o_ptr->number) ? "Á´Éô" :
4823 (amt > 1 ? "²¿¸Ä¤«" : "°ì¸Ä")) : "") );
4825 ((o_ptr->number > 1) ?
4826 ((amt == o_ptr->number) ? "All of y" :
4827 (amt > 1 ? "Some of y" : "One of y")) : "Y"),
4828 o_name, index_to_label(i),
4829 ((amt > 1) ? "were" : "was"));
4833 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
4834 msg_print("¤ä¤ê¤ä¤¬¤Ã¤¿¤Ê¡ª");
4837 /* Potions smash open */
4838 if (object_is_potion(o_ptr))
4840 (void)potion_smash_effect(0, py, px, o_ptr->k_idx);
4843 /* Reduce the charges of rods/wands */
4844 reduce_charges(o_ptr, amt);
4846 /* Destroy "amt" items */
4847 inven_item_increase(i, -amt);
4848 inven_item_optimize(i);
4850 /* Count the casualties */
4856 /* Return the casualty count */
4862 * Acid has hit the player, attempt to affect some armor.
4864 * Note that the "base armor" of an object never changes.
4866 * If any armor is damaged (or resists), the player takes less damage.
4868 static int minus_ac(void)
4870 object_type *o_ptr = NULL;
4871 u32b flgs[TR_FLAG_SIZE];
4872 char o_name[MAX_NLEN];
4875 /* Pick a (possibly empty) inventory slot */
4876 switch (randint1(7))
4878 case 1: o_ptr = &inventory[INVEN_RARM]; break;
4879 case 2: o_ptr = &inventory[INVEN_LARM]; break;
4880 case 3: o_ptr = &inventory[INVEN_BODY]; break;
4881 case 4: o_ptr = &inventory[INVEN_OUTER]; break;
4882 case 5: o_ptr = &inventory[INVEN_HANDS]; break;
4883 case 6: o_ptr = &inventory[INVEN_HEAD]; break;
4884 case 7: o_ptr = &inventory[INVEN_FEET]; break;
4887 /* Nothing to damage */
4888 if (!o_ptr->k_idx) return (FALSE);
4890 if (!object_is_armour(o_ptr)) return (FALSE);
4892 /* No damage left to be done */
4893 if (o_ptr->ac + o_ptr->to_a <= 0) return (FALSE);
4897 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
4899 /* Extract the flags */
4900 object_flags(o_ptr, flgs);
4902 /* Object resists */
4903 if (have_flag(flgs, TR_IGNORE_ACID))
4906 msg_format("¤·¤«¤·%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª", o_name);
4908 msg_format("Your %s is unaffected!", o_name);
4917 msg_format("%s¤¬¥À¥á¡¼¥¸¤ò¼õ¤±¤¿¡ª", o_name);
4919 msg_format("Your %s is damaged!", o_name);
4923 /* Damage the item */
4926 /* Calculate bonuses */
4927 p_ptr->update |= (PU_BONUS);
4930 p_ptr->window |= (PW_EQUIP | PW_PLAYER);
4934 /* Item was damaged */
4940 * Hurt the player with Acid
4942 int acid_dam(int dam, cptr kb_str, int monspell)
4945 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
4946 bool double_resist = IS_OPPOSE_ACID();
4948 /* Total Immunity */
4949 if (p_ptr->immune_acid || (dam <= 0))
4951 learn_spell(monspell);
4955 /* Vulnerability (Ouch!) */
4956 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
4957 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
4959 /* Resist the damage */
4960 if (p_ptr->resist_acid) dam = (dam + 2) / 3;
4961 if (double_resist) dam = (dam + 2) / 3;
4963 if ((!(double_resist || p_ptr->resist_acid)) &&
4964 one_in_(HURT_CHANCE))
4965 (void)do_dec_stat(A_CHR);
4967 /* If any armor gets hit, defend the player */
4968 if (minus_ac()) dam = (dam + 1) / 2;
4971 get_damage=take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
4973 /* Inventory damage */
4974 if (!(double_resist && p_ptr->resist_acid))
4975 inven_damage(set_acid_destroy, inv);
4981 * Hurt the player with electricity
4983 int elec_dam(int dam, cptr kb_str, int monspell)
4986 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
4987 bool double_resist = IS_OPPOSE_ELEC();
4989 /* Total immunity */
4990 if (p_ptr->immune_elec || (dam <= 0))
4992 learn_spell(monspell);
4996 /* Vulnerability (Ouch!) */
4997 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
4998 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
4999 if (prace_is_(RACE_ANDROID)) dam += dam / 3;
5001 /* Resist the damage */
5002 if (p_ptr->resist_elec) dam = (dam + 2) / 3;
5003 if (double_resist) dam = (dam + 2) / 3;
5005 if ((!(double_resist || p_ptr->resist_elec)) &&
5006 one_in_(HURT_CHANCE))
5007 (void)do_dec_stat(A_DEX);
5010 get_damage=take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
5012 /* Inventory damage */
5013 if (!(double_resist && p_ptr->resist_elec))
5014 inven_damage(set_elec_destroy, inv);
5021 * Hurt the player with Fire
5023 int fire_dam(int dam, cptr kb_str, int monspell)
5026 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
5027 bool double_resist = IS_OPPOSE_FIRE();
5029 /* Totally immune */
5030 if (p_ptr->immune_fire || (dam <= 0))
5032 learn_spell(monspell);
5036 /* Vulnerability (Ouch!) */
5037 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
5038 if (prace_is_(RACE_ENT)) dam += dam / 3;
5039 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
5041 /* Resist the damage */
5042 if (p_ptr->resist_fire) dam = (dam + 2) / 3;
5043 if (double_resist) dam = (dam + 2) / 3;
5045 if ((!(double_resist || p_ptr->resist_fire)) &&
5046 one_in_(HURT_CHANCE))
5047 (void)do_dec_stat(A_STR);
5050 get_damage=take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
5052 /* Inventory damage */
5053 if (!(double_resist && p_ptr->resist_fire))
5054 inven_damage(set_fire_destroy, inv);
5061 * Hurt the player with Cold
5063 int cold_dam(int dam, cptr kb_str, int monspell)
5066 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
5067 bool double_resist = IS_OPPOSE_COLD();
5069 /* Total immunity */
5070 if (p_ptr->immune_cold || (dam <= 0))
5072 learn_spell(monspell);
5076 /* Vulnerability (Ouch!) */
5077 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
5078 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
5080 /* Resist the damage */
5081 if (p_ptr->resist_cold) dam = (dam + 2) / 3;
5082 if (double_resist) dam = (dam + 2) / 3;
5084 if ((!(double_resist || p_ptr->resist_cold)) &&
5085 one_in_(HURT_CHANCE))
5086 (void)do_dec_stat(A_STR);
5089 get_damage=take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
5091 /* Inventory damage */
5092 if (!(double_resist && p_ptr->resist_cold))
5093 inven_damage(set_cold_destroy, inv);
5099 bool rustproof(void)
5103 char o_name[MAX_NLEN];
5106 item_tester_no_ryoute = TRUE;
5107 /* Select a piece of armour */
5108 item_tester_hook = object_is_armour;
5112 q = "¤É¤ÎËɶñ¤Ë»¬»ß¤á¤ò¤·¤Þ¤¹¤«¡©";
5113 s = "»¬»ß¤á¤Ç¤¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
5115 q = "Rustproof which piece of armour? ";
5116 s = "You have nothing to rustproof.";
5119 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return FALSE;
5121 /* Get the item (in the pack) */
5124 o_ptr = &inventory[item];
5127 /* Get the item (on the floor) */
5130 o_ptr = &o_list[0 - item];
5135 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
5137 add_flag(o_ptr->art_flags, TR_IGNORE_ACID);
5139 if ((o_ptr->to_a < 0) && !object_is_cursed(o_ptr))
5142 msg_format("%s¤Ï¿·ÉÊƱÍͤˤʤä¿¡ª",o_name);
5144 msg_format("%s %s look%s as good as new!",
5145 ((item >= 0) ? "Your" : "The"), o_name,
5146 ((o_ptr->number > 1) ? "" : "s"));
5153 msg_format("%s¤ÏÉå¿©¤·¤Ê¤¯¤Ê¤Ã¤¿¡£", o_name);
5155 msg_format("%s %s %s now protected against corrosion.",
5156 ((item >= 0) ? "Your" : "The"), o_name,
5157 ((o_ptr->number > 1) ? "are" : "is"));
5168 * Curse the players armor
5170 bool curse_armor(void)
5175 char o_name[MAX_NLEN];
5178 /* Curse the body armor */
5179 o_ptr = &inventory[INVEN_BODY];
5181 /* Nothing to curse */
5182 if (!o_ptr->k_idx) return (FALSE);
5186 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
5188 /* Attempt a saving throw for artifacts */
5189 if (object_is_artifact(o_ptr) && (randint0(100) < 50))
5193 msg_format("%s¤¬%s¤òÊñ¤ß¹þ¤â¤¦¤È¤·¤¿¤¬¡¢%s¤Ï¤½¤ì¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
5194 "¶²ÉݤΰŹõ¥ª¡¼¥é", "Ëɶñ", o_name);
5196 msg_format("A %s tries to %s, but your %s resists the effects!",
5197 "terrible black aura", "surround your armor", o_name);
5202 /* not artifact or failed save... */
5207 msg_format("¶²ÉݤΰŹõ¥ª¡¼¥é¤¬¤¢¤Ê¤¿¤Î%s¤òÊñ¤ß¹þ¤ó¤À¡ª", o_name);
5209 msg_format("A terrible black aura blasts your %s!", o_name);
5212 chg_virtue(V_ENCHANT, -5);
5214 /* Blast the armor */
5216 o_ptr->name2 = EGO_BLASTED;
5217 o_ptr->to_a = 0 - randint1(5) - randint1(5);
5224 for (i = 0; i < TR_FLAG_SIZE; i++)
5225 o_ptr->art_flags[i] = 0;
5228 o_ptr->curse_flags = TRC_CURSED;
5231 o_ptr->ident |= (IDENT_BROKEN);
5233 /* Recalculate bonuses */
5234 p_ptr->update |= (PU_BONUS);
5236 /* Recalculate mana */
5237 p_ptr->update |= (PU_MANA);
5240 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
5248 * Curse the players weapon
5250 bool curse_weapon(bool force, int slot)
5256 char o_name[MAX_NLEN];
5259 /* Curse the weapon */
5260 o_ptr = &inventory[slot];
5262 /* Nothing to curse */
5263 if (!o_ptr->k_idx) return (FALSE);
5267 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
5269 /* Attempt a saving throw */
5270 if (object_is_artifact(o_ptr) && (randint0(100) < 50) && !force)
5274 msg_format("%s¤¬%s¤òÊñ¤ß¹þ¤â¤¦¤È¤·¤¿¤¬¡¢%s¤Ï¤½¤ì¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
5275 "¶²ÉݤΰŹõ¥ª¡¼¥é", "Éð´ï", o_name);
5277 msg_format("A %s tries to %s, but your %s resists the effects!",
5278 "terrible black aura", "surround your weapon", o_name);
5283 /* not artifact or failed save... */
5288 if (!force) msg_format("¶²ÉݤΰŹõ¥ª¡¼¥é¤¬¤¢¤Ê¤¿¤Î%s¤òÊñ¤ß¹þ¤ó¤À¡ª", o_name);
5290 if (!force) msg_format("A terrible black aura blasts your %s!", o_name);
5293 chg_virtue(V_ENCHANT, -5);
5295 /* Shatter the weapon */
5297 o_ptr->name2 = EGO_SHATTERED;
5298 o_ptr->to_h = 0 - randint1(5) - randint1(5);
5299 o_ptr->to_d = 0 - randint1(5) - randint1(5);
5305 for (i = 0; i < TR_FLAG_SIZE; i++)
5306 o_ptr->art_flags[i] = 0;
5310 o_ptr->curse_flags = TRC_CURSED;
5313 o_ptr->ident |= (IDENT_BROKEN);
5315 /* Recalculate bonuses */
5316 p_ptr->update |= (PU_BONUS);
5318 /* Recalculate mana */
5319 p_ptr->update |= (PU_MANA);
5322 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
5331 * Enchant some bolts
5333 bool brand_bolts(void)
5337 /* Use the first acceptable bolts */
5338 for (i = 0; i < INVEN_PACK; i++)
5340 object_type *o_ptr = &inventory[i];
5342 /* Skip non-bolts */
5343 if (o_ptr->tval != TV_BOLT) continue;
5345 /* Skip artifacts and ego-items */
5346 if (object_is_artifact(o_ptr) || object_is_ego(o_ptr))
5349 /* Skip cursed/broken items */
5350 if (object_is_cursed(o_ptr) || object_is_broken(o_ptr)) continue;
5353 if (randint0(100) < 75) continue;
5357 msg_print("¥¯¥í¥¹¥Ü¥¦¤ÎÌ𤬱ê¤Î¥ª¡¼¥é¤ËÊñ¤Þ¤ì¤¿¡ª");
5359 msg_print("Your bolts are covered in a fiery aura!");
5364 o_ptr->name2 = EGO_FLAME;
5367 enchant(o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
5374 if (flush_failure) flush();
5378 msg_print("±ê¤Ç¶¯²½¤¹¤ë¤Î¤Ë¼ºÇÔ¤·¤¿¡£");
5380 msg_print("The fiery enchantment failed.");
5390 * Helper function -- return a "nearby" race for polymorphing
5392 * Note that this function is one of the more "dangerous" ones...
5394 static s16b poly_r_idx(int r_idx)
5396 monster_race *r_ptr = &r_info[r_idx];
5398 int i, r, lev1, lev2;
5400 /* Hack -- Uniques/Questors never polymorph */
5401 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5402 (r_ptr->flags1 & RF1_QUESTOR))
5405 /* Allowable range of "levels" for resulting monster */
5406 lev1 = r_ptr->level - ((randint1(20) / randint1(9)) + 1);
5407 lev2 = r_ptr->level + ((randint1(20) / randint1(9)) + 1);
5409 /* Pick a (possibly new) non-unique race */
5410 for (i = 0; i < 1000; i++)
5412 /* Pick a new race, using a level calculation */
5413 r = get_mon_num((dun_level + r_ptr->level) / 2 + 5);
5415 /* Handle failure */
5421 /* Ignore unique monsters */
5422 if (r_ptr->flags1 & RF1_UNIQUE) continue;
5424 /* Ignore monsters with incompatible levels */
5425 if ((r_ptr->level < lev1) || (r_ptr->level > lev2)) continue;
5427 /* Use that index */
5439 bool polymorph_monster(int y, int x)
5441 cave_type *c_ptr = &cave[y][x];
5442 monster_type *m_ptr = &m_list[c_ptr->m_idx];
5443 bool polymorphed = FALSE;
5445 int old_r_idx = m_ptr->r_idx;
5446 bool targeted = (target_who == c_ptr->m_idx) ? TRUE : FALSE;
5447 bool health_tracked = (p_ptr->health_who == c_ptr->m_idx) ? TRUE : FALSE;
5448 monster_type back_m;
5450 if (p_ptr->inside_arena || p_ptr->inside_battle) return (FALSE);
5452 if ((p_ptr->riding == c_ptr->m_idx) || (m_ptr->mflag2 & MFLAG2_KAGE)) return (FALSE);
5454 /* Memorize the monster before polymorphing */
5457 /* Pick a "new" monster race */
5458 new_r_idx = poly_r_idx(old_r_idx);
5460 /* Handle polymorph */
5461 if (new_r_idx != old_r_idx)
5465 /* Get the monsters attitude */
5466 if (is_friendly(m_ptr)) mode |= PM_FORCE_FRIENDLY;
5467 if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
5468 if (m_ptr->mflag2 & MFLAG2_NOPET) mode |= PM_NO_PET;
5470 /* "Kill" the "old" monster */
5471 delete_monster_idx(c_ptr->m_idx);
5473 /* Create a new monster (no groups) */
5474 if (place_monster_aux(0, y, x, new_r_idx, mode))
5481 /* Placing the new monster failed */
5482 if (place_monster_aux(0, y, x, old_r_idx, (mode | PM_NO_KAGE | PM_IGNORE_TERRAIN)))
5484 m_list[hack_m_idx_ii] = back_m;
5486 /* Re-initialize monster process */
5491 if (targeted) target_who = hack_m_idx_ii;
5492 if (health_tracked) health_track(hack_m_idx_ii);
5502 static bool dimension_door_aux(int x, int y)
5504 int plev = p_ptr->lev;
5506 p_ptr->energy_need += (s16b)((s32b)(60 - plev) * ENERGY_NEED() / 100L);
5508 if (!cave_player_teleportable_bold(y, x, FALSE, FALSE) ||
5509 (distance(y, x, py, px) > plev / 2 + 10) ||
5510 (!randint0(plev / 10 + 10)))
5512 p_ptr->energy_need += (s16b)((s32b)(60 - plev) * ENERGY_NEED() / 100L);
5513 teleport_player((plev + 2) * 2, TRUE);
5520 teleport_player_to(y, x, TRUE, FALSE);
5531 bool dimension_door(void)
5535 /* Rerutn FALSE if cancelled */
5536 if (!tgt_pt(&x, &y)) return FALSE;
5538 if (dimension_door_aux(x, y)) return TRUE;
5541 msg_print("ÀºÎ¤«¤éʪ¼Á³¦¤ËÌá¤ë»þ¤¦¤Þ¤¯¤¤¤«¤Ê¤«¤Ã¤¿¡ª");
5543 msg_print("You fail to exit the astral plane correctly!");
5551 * Mirror Master's Dimension Door
5553 bool mirror_tunnel(void)
5557 /* Rerutn FALSE if cancelled */
5558 if (!tgt_pt(&x, &y)) return FALSE;
5560 if (dimension_door_aux(x, y)) return TRUE;
5563 msg_print("¶À¤ÎÀ¤³¦¤ò¤¦¤Þ¤¯Ä̤ì¤Ê¤«¤Ã¤¿¡ª");
5565 msg_print("You fail to pass the mirror plane correctly!");
5572 bool eat_magic(int power)
5574 object_type * o_ptr;
5577 int recharge_strength = 0;
5583 char o_name[MAX_NLEN];
5585 item_tester_hook = item_tester_hook_recharge;
5589 q = "¤É¤Î¥¢¥¤¥Æ¥à¤«¤éËâÎϤòµÛ¼ý¤·¤Þ¤¹¤«¡©";
5590 s = "ËâÎϤòµÛ¼ý¤Ç¤¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£";
5592 q = "Drain which item? ";
5593 s = "You have nothing to drain.";
5596 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return FALSE;
5600 o_ptr = &inventory[item];
5604 o_ptr = &o_list[0 - item];
5607 k_ptr = &k_info[o_ptr->k_idx];
5608 lev = k_info[o_ptr->k_idx].level;
5610 if (o_ptr->tval == TV_ROD)
5612 recharge_strength = ((power > lev/2) ? (power - lev/2) : 0) / 5;
5615 if (one_in_(recharge_strength))
5617 /* Activate the failure code. */
5622 if (o_ptr->timeout > (o_ptr->number - 1) * k_ptr->pval)
5625 msg_print("½¼Å¶Ãæ¤Î¥í¥Ã¥É¤«¤éËâÎϤòµÛ¼ý¤¹¤ë¤³¤È¤Ï¤Ç¤¤Þ¤»¤ó¡£");
5627 msg_print("You can't absorb energy from a discharged rod.");
5634 o_ptr->timeout += k_ptr->pval;
5640 /* All staffs, wands. */
5641 recharge_strength = (100 + power - lev) / 15;
5644 if (recharge_strength < 0) recharge_strength = 0;
5647 if (one_in_(recharge_strength))
5649 /* Activate the failure code. */
5654 if (o_ptr->pval > 0)
5656 p_ptr->csp += lev / 2;
5659 /* XXX Hack -- unstack if necessary */
5660 if ((o_ptr->tval == TV_STAFF) && (item >= 0) && (o_ptr->number > 1))
5665 /* Get local object */
5668 /* Obtain a local object */
5669 object_copy(q_ptr, o_ptr);
5671 /* Modify quantity */
5674 /* Restore the charges */
5677 /* Unstack the used item */
5679 p_ptr->total_weight -= q_ptr->weight;
5680 item = inven_carry(q_ptr);
5684 msg_print("¾ó¤ò¤Þ¤È¤á¤Ê¤ª¤·¤¿¡£");
5686 msg_print("You unstack your staff.");
5694 msg_print("µÛ¼ý¤Ç¤¤ëËâÎϤ¬¤¢¤ê¤Þ¤»¤ó¡ª");
5696 msg_print("There's no energy there to absorb!");
5700 if (!o_ptr->pval) o_ptr->ident |= IDENT_EMPTY;
5704 /* Inflict the penalties for failing a recharge. */
5707 /* Artifacts are never destroyed. */
5708 if (object_is_fixed_artifact(o_ptr))
5710 object_desc(o_name, o_ptr, OD_NAME_ONLY);
5712 msg_format("ËâÎϤ¬µÕή¤·¤¿¡ª%s¤Ï´°Á´¤ËËâÎϤò¼º¤Ã¤¿¡£", o_name);
5714 msg_format("The recharging backfires - %s is completely drained!", o_name);
5718 /* Artifact rods. */
5719 if (o_ptr->tval == TV_ROD)
5720 o_ptr->timeout = k_ptr->pval * o_ptr->number;
5722 /* Artifact wands and staffs. */
5723 else if ((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_STAFF))
5728 /* Get the object description */
5729 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
5731 /*** Determine Seriousness of Failure ***/
5733 /* Mages recharge objects more safely. */
5734 if (p_ptr->pclass == CLASS_MAGE || p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER || p_ptr->pclass == CLASS_MAGIC_EATER || p_ptr->pclass == CLASS_BLUE_MAGE)
5736 /* 10% chance to blow up one rod, otherwise draining. */
5737 if (o_ptr->tval == TV_ROD)
5739 if (one_in_(10)) fail_type = 2;
5742 /* 75% chance to blow up one wand, otherwise draining. */
5743 else if (o_ptr->tval == TV_WAND)
5745 if (!one_in_(3)) fail_type = 2;
5748 /* 50% chance to blow up one staff, otherwise no effect. */
5749 else if (o_ptr->tval == TV_STAFF)
5751 if (one_in_(2)) fail_type = 2;
5756 /* All other classes get no special favors. */
5759 /* 33% chance to blow up one rod, otherwise draining. */
5760 if (o_ptr->tval == TV_ROD)
5762 if (one_in_(3)) fail_type = 2;
5765 /* 20% chance of the entire stack, else destroy one wand. */
5766 else if (o_ptr->tval == TV_WAND)
5768 if (one_in_(5)) fail_type = 3;
5771 /* Blow up one staff. */
5772 else if (o_ptr->tval == TV_STAFF)
5778 /*** Apply draining and destruction. ***/
5780 /* Drain object or stack of objects. */
5783 if (o_ptr->tval == TV_ROD)
5786 msg_print("¥í¥Ã¥É¤ÏÇË»¤òÌȤ줿¤¬¡¢ËâÎϤÏÁ´¤Æ¼º¤Ê¤ï¤ì¤¿¡£");
5788 msg_format("You save your rod from destruction, but all charges are lost.", o_name);
5791 o_ptr->timeout = k_ptr->pval * o_ptr->number;
5793 else if (o_ptr->tval == TV_WAND)
5796 msg_format("%s¤ÏÇË»¤òÌȤ줿¤¬¡¢ËâÎϤ¬Á´¤Æ¼º¤ï¤ì¤¿¡£", o_name);
5798 msg_format("You save your %s from destruction, but all charges are lost.", o_name);
5803 /* Staffs aren't drained. */
5806 /* Destroy an object or one in a stack of objects. */
5809 if (o_ptr->number > 1)
5812 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬°ìËܲõ¤ì¤¿¡ª", o_name);
5814 msg_format("Wild magic consumes one of your %s!", o_name);
5817 /* Reduce rod stack maximum timeout, drain wands. */
5818 if (o_ptr->tval == TV_ROD) o_ptr->timeout = MIN(o_ptr->timeout, k_ptr->pval * (o_ptr->number - 1));
5819 else if (o_ptr->tval == TV_WAND) o_ptr->pval = o_ptr->pval * (o_ptr->number - 1) / o_ptr->number;
5824 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²¿Ëܤ«²õ¤ì¤¿¡ª", o_name);
5826 msg_format("Wild magic consumes your %s!", o_name);
5829 /* Reduce and describe inventory */
5832 inven_item_increase(item, -1);
5833 inven_item_describe(item);
5834 inven_item_optimize(item);
5837 /* Reduce and describe floor item */
5840 floor_item_increase(0 - item, -1);
5841 floor_item_describe(0 - item);
5842 floor_item_optimize(0 - item);
5846 /* Destroy all members of a stack of objects. */
5849 if (o_ptr->number > 1)
5851 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬Á´¤Æ²õ¤ì¤¿¡ª", o_name);
5853 msg_format("Wild magic consumes all your %s!", o_name);
5858 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²õ¤ì¤¿¡ª", o_name);
5860 msg_format("Wild magic consumes your %s!", o_name);
5865 /* Reduce and describe inventory */
5868 inven_item_increase(item, -999);
5869 inven_item_describe(item);
5870 inven_item_optimize(item);
5873 /* Reduce and describe floor item */
5876 floor_item_increase(0 - item, -999);
5877 floor_item_describe(0 - item);
5878 floor_item_optimize(0 - item);
5884 if (p_ptr->csp > p_ptr->msp)
5886 p_ptr->csp = p_ptr->msp;
5889 /* Redraw mana and hp */
5890 p_ptr->redraw |= (PR_MANA);
5892 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
5893 p_ptr->window |= (PW_INVEN);
5899 bool summon_kin_player(int level, int y, int x, u32b mode)
5901 bool pet = (bool)(mode & PM_FORCE_PET);
5902 if (!pet) mode |= PM_NO_PET;
5904 switch (p_ptr->mimic_form)
5907 switch (p_ptr->prace)
5911 case RACE_BARBARIAN:
5914 summon_kin_type = 'p';
5924 case RACE_MIND_FLAYER:
5927 summon_kin_type = 'h';
5930 summon_kin_type = 'o';
5932 case RACE_HALF_TROLL:
5933 summon_kin_type = 'T';
5935 case RACE_HALF_OGRE:
5936 summon_kin_type = 'O';
5938 case RACE_HALF_GIANT:
5939 case RACE_HALF_TITAN:
5941 summon_kin_type = 'P';
5944 summon_kin_type = 'y';
5947 summon_kin_type = 'K';
5950 summon_kin_type = 'k';
5953 if (one_in_(13)) summon_kin_type = 'U';
5954 else summon_kin_type = 'u';
5956 case RACE_DRACONIAN:
5957 summon_kin_type = 'd';
5961 summon_kin_type = 'g';
5964 if (one_in_(13)) summon_kin_type = 'L';
5965 else summon_kin_type = 's';
5968 summon_kin_type = 'z';
5971 summon_kin_type = 'V';
5974 summon_kin_type = 'G';
5977 summon_kin_type = 'I';
5980 summon_kin_type = '#';
5983 summon_kin_type = 'A';
5986 summon_kin_type = 'U';
5989 summon_kin_type = 'p';
5994 if (one_in_(13)) summon_kin_type = 'U';
5995 else summon_kin_type = 'u';
5997 case MIMIC_DEMON_LORD:
5998 summon_kin_type = 'U';
6001 summon_kin_type = 'V';
6004 return summon_specific((pet ? -1 : 0), y, x, level, SUMMON_KIN, mode);