3 /* Purpose: Spell code (part 3) */
6 * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research, and
9 * not for profit purposes provided that this copyright and statement are
10 * included in all such copies.
15 /* Maximum number of tries for teleporting */
18 /* 1/x chance of reducing stats (for elemental attacks) */
19 #define HURT_CHANCE 16
23 * Teleport a monster, normally up to "dis" grids away.
25 * Attempt to move the monster at least "dis/2" grids away.
27 * But allow variation to prevent infinite loops.
29 bool teleport_away(int m_idx, int dis, bool dec_valour)
31 int oy, ox, d, i, min;
37 monster_type *m_ptr = &m_list[m_idx];
41 if (!m_ptr->r_idx) return (FALSE);
43 /* Save the old location */
47 /* Minimum distance */
51 (((p_ptr->chp * 10) / p_ptr->mhp) > 5) &&
52 (4+randint1(5) < ((p_ptr->chp * 10) / p_ptr->mhp)))
54 chg_virtue(V_VALOUR, -1);
62 /* Verify max distance */
63 if (dis > 200) dis = 200;
65 /* Try several locations */
66 for (i = 0; i < 500; i++)
68 /* Pick a (possibly illegal) location */
71 ny = rand_spread(oy, dis);
72 nx = rand_spread(ox, dis);
73 d = distance(oy, ox, ny, nx);
74 if ((d >= min) && (d <= dis)) break;
77 /* Ignore illegal locations */
78 if (!in_bounds(ny, nx)) continue;
80 /* Require "empty" floor space */
81 if (!cave_empty_bold(ny, nx)) continue;
83 /* Hack -- no teleport onto glyph of warding */
84 if (cave[ny][nx].feat == FEAT_GLYPH) continue;
85 if (cave[ny][nx].feat == FEAT_MINOR_GLYPH) continue;
87 /* ...nor onto the Pattern */
88 if ((cave[ny][nx].feat >= FEAT_PATTERN_START) &&
89 (cave[ny][nx].feat <= FEAT_PATTERN_XTRA2)) continue;
91 /* No teleporting into vaults and such */
92 if (!(p_ptr->inside_quest || p_ptr->inside_arena))
93 if (cave[ny][nx].info & CAVE_ICKY) continue;
95 /* This grid looks good */
102 /* Increase the maximum distance */
105 /* Decrease the minimum distance */
108 /* Stop after MAX_TRIES tries */
109 if (tries > MAX_TRIES) return (FALSE);
113 sound(SOUND_TPOTHER);
115 /* Update the new location */
116 cave[ny][nx].m_idx = m_idx;
118 /* Update the old location */
119 cave[oy][ox].m_idx = 0;
121 /* Move the monster */
125 /* Forget the counter target */
128 /* Update the monster (new location) */
129 update_mon(m_idx, TRUE);
131 /* Redraw the old grid */
134 /* Redraw the new grid */
143 * Teleport monster next to the player
145 void teleport_to_player(int m_idx, int power)
147 int ny, nx, oy, ox, d, i, min;
151 monster_type *m_ptr = &m_list[m_idx];
155 if (!m_ptr->r_idx) return;
158 if (randint1(100) > power) return;
164 /* Save the old location */
168 /* Minimum distance */
171 /* Look until done */
172 while (look && --attempts)
174 /* Verify max distance */
175 if (dis > 200) dis = 200;
177 /* Try several locations */
178 for (i = 0; i < 500; i++)
180 /* Pick a (possibly illegal) location */
183 ny = rand_spread(py, dis);
184 nx = rand_spread(px, dis);
185 d = distance(py, px, ny, nx);
186 if ((d >= min) && (d <= dis)) break;
189 /* Ignore illegal locations */
190 if (!in_bounds(ny, nx)) continue;
192 /* Require "empty" floor space */
193 if (!cave_empty_bold(ny, nx)) continue;
195 /* Hack -- no teleport onto glyph of warding */
196 if (cave[ny][nx].feat == FEAT_GLYPH) continue;
197 if (cave[ny][nx].feat == FEAT_MINOR_GLYPH) continue;
199 /* ...nor onto the Pattern */
200 if ((cave[ny][nx].feat >= FEAT_PATTERN_START) &&
201 (cave[ny][nx].feat <= FEAT_PATTERN_XTRA2)) continue;
203 /* No teleporting into vaults and such */
204 /* if (cave[ny][nx].info & (CAVE_ICKY)) continue; */
206 /* This grid looks good */
213 /* Increase the maximum distance */
216 /* Decrease the minimum distance */
220 if (attempts < 1) return;
223 sound(SOUND_TPOTHER);
225 /* Update the new location */
226 cave[ny][nx].m_idx = m_idx;
228 /* Update the old location */
229 cave[oy][ox].m_idx = 0;
231 /* Move the monster */
235 /* Update the monster (new location) */
236 update_mon(m_idx, TRUE);
238 /* Redraw the old grid */
241 /* Redraw the new grid */
244 p_ptr->update |= (PU_MON_LITE);
249 * Teleport the player to a location up to "dis" grids away.
251 * If no such spaces are readily available, the distance may increase.
252 * Try very hard to move the player at least a quarter that distance.
254 * When long-range teleport effects are considered, there is a nasty
255 * tendency to "bounce" the player between two or three different spots
256 * because these are the only spots that are "far enough" way to satisfy
257 * the algorithm. Therefore, if the teleport distance is more than 50,
258 * we decrease the minimum acceptable distance to try to increase randomness.
261 void teleport_player(int dis)
263 int d, i, min, ox, oy;
266 int xx = -1, yy = -1;
274 if (p_ptr->wild_mode) return;
276 if (p_ptr->anti_tele)
279 msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
281 msg_print("A mysterious force prevents you from teleporting!");
287 if (dis > 200) dis = 200; /* To be on the safe side... */
289 /* Minimum distance */
290 min = dis / (dis > 50 ? 3 : 2);
292 /* Look until done */
297 /* Verify max distance */
298 if (dis > 200) dis = 200;
300 /* Try several locations */
301 for (i = 0; i < 500; i++)
303 /* Pick a (possibly illegal) location */
306 y = rand_spread(py, dis);
307 x = rand_spread(px, dis);
308 d = distance(py, px, y, x);
309 if ((d >= min) && (d <= dis)) break;
312 /* Ignore illegal locations */
313 if (!in_bounds(y, x)) continue;
315 /* Require "naked" floor space or trees */
316 if (!(cave_naked_bold(y, x) ||
317 (cave[y][x].feat == FEAT_TREES))) continue;
319 /* No teleporting into vaults and such */
320 if (cave[y][x].info & CAVE_ICKY) continue;
322 /* This grid looks good */
329 /* Increase the maximum distance */
332 /* Decrease the minimum distance */
335 /* Stop after MAX_TRIES tries */
336 if (tries > MAX_TRIES) return;
340 sound(SOUND_TELEPORT);
343 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
344 msg_format("¡Ø¤³¤Ã¤Á¤À¤¡¡¢%s¡Ù", player_name);
347 /* Save the old location */
351 /* Move the player */
358 tmp = cave[py][px].m_idx;
359 cave[py][px].m_idx = cave[oy][ox].m_idx;
360 cave[oy][ox].m_idx = tmp;
361 m_list[p_ptr->riding].fy = py;
362 m_list[p_ptr->riding].fx = px;
363 update_mon(cave[py][px].m_idx, TRUE);
366 /* Redraw the old spot */
369 /* Monsters with teleport ability may follow the player */
376 if (xx == 0 && yy == 0)
382 if (cave[oy+yy][ox+xx].m_idx)
384 if ((r_info[m_list[cave[oy+yy][ox+xx].m_idx].r_idx].flags6 & RF6_TPORT) &&
385 !(r_info[m_list[cave[oy+yy][ox+xx].m_idx].r_idx].flags3 & RF3_RES_TELE))
387 * The latter limitation is to avoid
388 * totally unkillable suckers...
391 if (!(m_list[cave[oy+yy][ox+xx].m_idx].csleep))
392 teleport_to_player(cave[oy+yy][ox+xx].m_idx, r_info[m_list[cave[oy+yy][ox+xx].m_idx].r_idx].level);
403 /* Redraw the new spot */
406 /* Check for new panel (redraw map) */
410 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
412 /* Update the monsters */
413 p_ptr->update |= (PU_DISTANCE);
416 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
418 /* Handle stuff XXX XXX XXX */
425 * Teleport player to a grid near the given location
427 * This function is slightly obsessive about correctness.
428 * This function allows teleporting into vaults (!)
430 void teleport_player_to(int ny, int nx, bool no_tele)
432 int y, x, oy, ox, dis = 0, ctr = 0;
434 if (p_ptr->anti_tele && no_tele)
437 msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
439 msg_print("A mysterious force prevents you from teleporting!");
445 /* Find a usable location */
448 /* Pick a nearby legal location */
451 y = rand_spread(ny, dis);
452 x = rand_spread(nx, dis);
453 if (in_bounds(y, x)) break;
456 /* Accept "naked" floor grids */
459 if (cave_naked_bold(y, x) || (((cave[y][x].feat == FEAT_DEEP_LAVA) || (cave[y][x].feat == FEAT_DEEP_WATER)) && !cave[y][x].m_idx)) break;
461 else if (cave_empty_bold(y, x) || ((y == py) && (x == px))) break;
463 /* Occasionally advance the distance */
464 if (++ctr > (4 * dis * dis + 4 * dis + 1))
472 sound(SOUND_TELEPORT);
474 /* Save the old location */
478 /* Move the player */
485 tmp = cave[py][px].m_idx;
486 cave[py][px].m_idx = cave[oy][ox].m_idx;
487 cave[oy][ox].m_idx = tmp;
488 m_list[p_ptr->riding].fy = py;
489 m_list[p_ptr->riding].fx = px;
490 update_mon(cave[py][px].m_idx, TRUE);
495 /* Redraw the old spot */
498 /* Redraw the new spot */
501 /* Check for new panel (redraw map) */
505 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
507 /* Update the monsters */
508 p_ptr->update |= (PU_DISTANCE);
511 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
513 /* Handle stuff XXX XXX XXX */
520 * Teleport the player one level up or down (random when legal)
522 void teleport_player_level(void)
524 /* No effect in arena or quest */
525 if (p_ptr->inside_arena || (p_ptr->inside_quest && !random_quest_number(dun_level)) ||
526 (quest_number(dun_level) && (dun_level > 1) && ironman_downward))
529 msg_print("¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£");
531 msg_print("There is no effect.");
537 if (p_ptr->anti_tele)
540 msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
542 msg_print("A mysterious force prevents you from teleporting!");
548 if (ironman_downward || (dun_level <= d_info[dungeon_type].mindepth))
551 msg_print("¤¢¤Ê¤¿¤Ï¾²¤òÆͤÇˤäÆÄÀ¤ó¤Ç¤¤¤¯¡£");
553 msg_print("You sink through the floor.");
557 dungeon_type = p_ptr->recall_dungeon;
562 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL);
564 if (autosave_l) do_cmd_save_game(TRUE);
568 dun_level = d_info[dungeon_type].mindepth;
576 p_ptr->leaving = TRUE;
578 else if (quest_number(dun_level) || (dun_level >= d_info[dungeon_type].maxdepth))
581 msg_print("¤¢¤Ê¤¿¤ÏÅ·°æ¤òÆͤÇˤäÆÃè¤ØÉ⤤¤Æ¤¤¤¯¡£");
583 msg_print("You rise up through the ceiling.");
587 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, -1, NULL);
589 if (autosave_l) do_cmd_save_game(TRUE);
593 if (!dun_level) dungeon_type = 0;
595 leaving_quest = p_ptr->inside_quest;
598 ((quest[leaving_quest].flags & QUEST_FLAG_ONCE) || (quest[leaving_quest].type == QUEST_TYPE_RANDOM)) &&
599 (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
601 quest[leaving_quest].status = QUEST_STATUS_FAILED;
602 quest[leaving_quest].complev = (byte)p_ptr->lev;
603 if (quest[leaving_quest].type == QUEST_TYPE_RANDOM)
605 r_info[quest[leaving_quest].r_idx].flags1 &= ~(RF1_QUESTOR);
606 if (record_rand_quest)
607 do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
609 else if (record_fix_quest)
610 do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
614 p_ptr->inside_quest = 0;
615 p_ptr->leaving = TRUE;
617 else if (randint0(100) < 50)
620 msg_print("¤¢¤Ê¤¿¤ÏÅ·°æ¤òÆͤÇˤäÆÃè¤ØÉ⤤¤Æ¤¤¤¯¡£");
622 msg_print("You rise up through the ceiling.");
626 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, -1, NULL);
628 if (autosave_l) do_cmd_save_game(TRUE);
632 if (!dun_level) dungeon_type = 0;
635 p_ptr->leaving = TRUE;
640 msg_print("¤¢¤Ê¤¿¤Ï¾²¤òÆͤÇˤäÆÄÀ¤ó¤Ç¤¤¤¯¡£");
642 msg_print("You sink through the floor.");
645 if (!dun_level) dungeon_type = p_ptr->recall_dungeon;
647 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL);
649 if (autosave_l) do_cmd_save_game(TRUE);
654 p_ptr->leaving = TRUE;
657 if (!dun_level && dungeon_type)
659 p_ptr->leaving_dungeon = TRUE;
660 p_ptr->wilderness_y = d_info[dungeon_type].dy;
661 p_ptr->wilderness_x = d_info[dungeon_type].dx;
662 p_ptr->recall_dungeon = dungeon_type;
665 if (!dun_level) dungeon_type = 0;
668 sound(SOUND_TPLEVEL);
673 static int choose_dungeon(cptr note)
679 /* Allocate the "dun" array */
680 C_MAKE(dun, max_d_idx, s16b);
683 for(i = 1; i < max_d_idx; i++)
688 if (!d_info[i].maxdepth) continue;
689 if (!max_dlv[i]) continue;
690 if (d_info[i].final_guardian)
692 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
694 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
697 sprintf(buf," %c) %c%-12s : ºÇÂç %d ³¬", 'a'+num, seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
699 sprintf(buf," %c) %c%-16s : Max level %d", 'a'+num, seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
705 prt(format("¤É¤Î¥À¥ó¥¸¥ç¥ó%s¤·¤Þ¤¹¤«:", note), 0, 0);
707 prt(format("Which dungeon do you %s?: ", note), 0, 0);
714 /* Free the "dun" array */
715 C_KILL(dun, max_d_idx, s16b);
720 if (i >= 'a' && i <('a'+num))
722 select_dungeon = dun[i-'a'];
729 /* Free the "dun" array */
730 C_KILL(dun, max_d_idx, s16b);
732 return select_dungeon;
737 * Recall the player to town or dungeon
739 bool recall_player(int turns)
742 * TODO: Recall the player to the last
743 * visited town when in the wilderness
747 if (p_ptr->inside_arena || ironman_downward)
750 msg_print("²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
752 msg_print("Nothing happens.");
758 if (dun_level && (max_dlv[dungeon_type] > dun_level) && !p_ptr->inside_quest && !p_ptr->word_recall)
761 if (get_check("¤³¤³¤ÏºÇ¿¼Åþ㳬¤è¤êÀõ¤¤³¬¤Ç¤¹¡£¤³¤Î³¬¤ËÌá¤Ã¤ÆÍè¤Þ¤¹¤«¡© "))
763 if (get_check("Reset recall depth? "))
766 max_dlv[dungeon_type] = dun_level;
767 if (record_maxdeapth)
769 do_cmd_write_nikki(NIKKI_TRUMP, dungeon_type, "µ¢´Ô¤Î¤È¤¤Ë");
771 do_cmd_write_nikki(NIKKI_TRUMP, dungeon_type, "when recall from dungeon");
776 if (!p_ptr->word_recall)
782 select_dungeon = choose_dungeon("¤Ëµ¢´Ô");
784 select_dungeon = choose_dungeon("recall");
786 if (!select_dungeon) return FALSE;
787 p_ptr->recall_dungeon = select_dungeon;
789 p_ptr->word_recall = turns;
791 msg_print("²ó¤ê¤ÎÂ絤¤¬Ä¥¤ê¤Ä¤á¤Æ¤¤¿...");
793 msg_print("The air about you becomes charged...");
796 p_ptr->redraw |= (PR_STATUS);
800 p_ptr->word_recall = 0;
802 msg_print("Ä¥¤ê¤Ä¤á¤¿Â絤¤¬Î®¤ìµî¤Ã¤¿...");
804 msg_print("A tension leaves the air around you...");
807 p_ptr->redraw |= (PR_STATUS);
813 bool word_of_recall(void)
815 return(recall_player(randint0(21) + 15));
819 bool reset_recall(void)
821 int select_dungeon, dummy = 0;
826 select_dungeon = choose_dungeon("¤ò¥»¥Ã¥È");
828 select_dungeon = choose_dungeon("reset");
831 if (!select_dungeon) return FALSE;
834 sprintf(ppp, "²¿³¬¤Ë¥»¥Ã¥È¤·¤Þ¤¹¤« (%d-%d):", d_info[select_dungeon].mindepth, max_dlv[select_dungeon]);
836 sprintf(ppp, "Reset to which level (%d-%d): ", d_info[select_dungeon].mindepth, max_dlv[select_dungeon]);
841 sprintf(tmp_val, "%d", MAX(dun_level, 1));
843 /* Ask for a level */
844 if (get_string(ppp, tmp_val, 10))
846 /* Extract request */
847 dummy = atoi(tmp_val);
850 if (dummy < 1) dummy = 1;
853 if (dummy > max_dlv[select_dungeon]) dummy = max_dlv[select_dungeon];
854 if (dummy < d_info[select_dungeon].mindepth) dummy = d_info[select_dungeon].mindepth;
856 max_dlv[select_dungeon] = dummy;
858 if (record_maxdeapth)
860 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "¥Õ¥í¥¢¡¦¥ê¥»¥Ã¥È¤Ç");
862 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "using a scroll of reset recall");
866 msg_format("%s¤Îµ¢´Ô¥ì¥Ù¥ë¤ò %d ³¬¤Ë¥»¥Ã¥È¡£", d_name+d_info[select_dungeon].name, dummy, dummy * 50);
868 msg_format("Recall depth set to level %d (%d').", dummy, dummy * 50);
881 * Apply disenchantment to the player's stuff
883 * XXX XXX XXX This function is also called from the "melee" code
885 * The "mode" is currently unused.
887 * Return "TRUE" if the player notices anything
889 bool apply_disenchant(int mode)
893 char o_name[MAX_NLEN];
900 /* Pick a random slot */
903 case 1: t = INVEN_RARM; break;
904 case 2: t = INVEN_LARM; break;
905 case 3: t = INVEN_BOW; break;
906 case 4: t = INVEN_BODY; break;
907 case 5: t = INVEN_OUTER; break;
908 case 6: t = INVEN_HEAD; break;
909 case 7: t = INVEN_HANDS; break;
910 case 8: t = INVEN_FEET; break;
914 o_ptr = &inventory[t];
916 /* No item, nothing happens */
917 if (!o_ptr->k_idx) return (FALSE);
920 /* Nothing to disenchant */
921 if ((o_ptr->to_h <= 0) && (o_ptr->to_d <= 0) && (o_ptr->to_a <= 0))
923 /* Nothing to notice */
928 /* Describe the object */
929 object_desc(o_name, o_ptr, FALSE, 0);
932 /* Artifacts have 71% chance to resist */
933 if ((artifact_p(o_ptr) || o_ptr->art_name) && (randint0(100) < 71))
937 msg_format("%s(%c)¤ÏÎô²½¤òÄ·¤ÍÊÖ¤·¤¿¡ª",o_name, index_to_label(t) );
939 msg_format("Your %s (%c) resist%s disenchantment!",
940 o_name, index_to_label(t),
941 ((o_ptr->number != 1) ? "" : "s"));
950 /* Disenchant tohit */
951 if (o_ptr->to_h > 0) o_ptr->to_h--;
952 if ((o_ptr->to_h > 5) && (randint0(100) < 20)) o_ptr->to_h--;
954 /* Disenchant todam */
955 if (o_ptr->to_d > 0) o_ptr->to_d--;
956 if ((o_ptr->to_d > 5) && (randint0(100) < 20)) o_ptr->to_d--;
958 /* Disenchant toac */
959 if (o_ptr->to_a > 0) o_ptr->to_a--;
960 if ((o_ptr->to_a > 5) && (randint0(100) < 20)) o_ptr->to_a--;
964 msg_format("%s(%c)¤ÏÎô²½¤·¤Æ¤·¤Þ¤Ã¤¿¡ª",
965 o_name, index_to_label(t) );
967 msg_format("Your %s (%c) %s disenchanted!",
968 o_name, index_to_label(t),
969 ((o_ptr->number != 1) ? "were" : "was"));
972 chg_virtue(V_HARMONY, 1);
973 chg_virtue(V_ENCHANT, -2);
975 /* Recalculate bonuses */
976 p_ptr->update |= (PU_BONUS);
979 p_ptr->window |= (PW_EQUIP | PW_PLAYER);
988 void mutate_player(void)
990 int max1, cur1, max2, cur2, ii, jj, i;
992 /* Pick a pair of stats */
994 for (jj = ii; jj == ii; jj = randint0(6)) /* loop */;
996 max1 = p_ptr->stat_max[ii];
997 cur1 = p_ptr->stat_cur[ii];
998 max2 = p_ptr->stat_max[jj];
999 cur2 = p_ptr->stat_cur[jj];
1001 p_ptr->stat_max[ii] = max2;
1002 p_ptr->stat_cur[ii] = cur2;
1003 p_ptr->stat_max[jj] = max1;
1004 p_ptr->stat_cur[jj] = cur1;
1008 if(p_ptr->stat_max[i] > p_ptr->stat_max_max[i]) p_ptr->stat_max[i] = p_ptr->stat_max_max[i];
1009 if(p_ptr->stat_cur[i] > p_ptr->stat_max_max[i]) p_ptr->stat_cur[i] = p_ptr->stat_max_max[i];
1012 p_ptr->update |= (PU_BONUS);
1019 void apply_nexus(monster_type *m_ptr)
1021 switch (randint1(7))
1023 case 1: case 2: case 3:
1025 teleport_player(200);
1031 teleport_player_to(m_ptr->fy, m_ptr->fx, TRUE);
1037 if (randint0(100) < p_ptr->skill_sav)
1040 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
1042 msg_print("You resist the effects!");
1048 /* Teleport Level */
1049 teleport_player_level();
1055 if (randint0(100) < p_ptr->skill_sav)
1058 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
1060 msg_print("You resist the effects!");
1067 msg_print("ÂΤ¬¤Í¤¸¤ì»Ï¤á¤¿...");
1069 msg_print("Your body starts to scramble...");
1080 * Charge a lite (torch or latern)
1082 void phlogiston(void)
1085 object_type * o_ptr = &inventory[INVEN_LITE];
1088 if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_LANTERN))
1090 max_flog = FUEL_LAMP;
1094 else if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_TORCH))
1096 max_flog = FUEL_TORCH;
1099 /* No torch to refill */
1103 msg_print("dzÁǤò¾ÃÈñ¤¹¤ë¥¢¥¤¥Æ¥à¤òÁõÈ÷¤·¤Æ¤¤¤Þ¤»¤ó¡£");
1105 msg_print("You are not wielding anything which uses phlogiston.");
1111 if (o_ptr->xtra4 >= max_flog)
1114 msg_print("¤³¤Î¥¢¥¤¥Æ¥à¤Ë¤Ï¤³¤ì°Ê¾ådzÁǤòÊä½¼¤Ç¤¤Þ¤»¤ó¡£");
1116 msg_print("No more phlogiston can be put in this item.");
1123 o_ptr->xtra4 += (max_flog / 2);
1127 msg_print("¾ÈÌÀÍÑ¥¢¥¤¥Æ¥à¤ËdzÁǤòÊä½¼¤·¤¿¡£");
1129 msg_print("You add phlogiston to your light item.");
1134 if (o_ptr->xtra4 >= max_flog)
1136 o_ptr->xtra4 = max_flog;
1138 msg_print("¾ÈÌÀÍÑ¥¢¥¤¥Æ¥à¤ÏËþ¥¿¥ó¤Ë¤Ê¤Ã¤¿¡£");
1140 msg_print("Your light item is full.");
1145 /* Recalculate torch */
1146 p_ptr->update |= (PU_TORCH);
1150 bool item_tester_hook_weapon_nobow(object_type *o_ptr)
1152 switch (o_ptr->tval)
1162 if (o_ptr->sval != SV_DOKUBARI) return (TRUE);
1170 * Brand the current weapon
1172 void brand_weapon(int brand_type)
1179 /* Assume enchant weapon */
1180 item_tester_hook = item_tester_hook_weapon_nobow;
1181 item_tester_no_ryoute = TRUE;
1185 q = "¤É¤ÎÉð´ï¤ò¶¯²½¤·¤Þ¤¹¤«? ";
1186 s = "¶¯²½¤Ç¤¤ëÉð´ï¤¬¤Ê¤¤¡£";
1188 q = "Enchant which weapon? ";
1189 s = "You have nothing to enchant.";
1192 if (!get_item(&item, q, s, (USE_EQUIP))) return;
1194 /* Get the item (in the pack) */
1197 o_ptr = &inventory[item];
1200 /* Get the item (on the floor) */
1203 o_ptr = &o_list[0 - item];
1207 /* you can never modify artifacts / ego-items */
1208 /* you can never modify cursed items */
1209 /* TY: You _can_ modify broken items (if you're silly enough) */
1210 if (o_ptr->k_idx && !artifact_p(o_ptr) && !ego_item_p(o_ptr) &&
1211 !o_ptr->art_name && !cursed_p(o_ptr) &&
1212 !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) &&
1213 !((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE)) &&
1214 !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DIAMOND_EDGE)))
1218 /* Let's get the name before it is changed... */
1219 char o_name[MAX_NLEN];
1220 object_desc(o_name, o_ptr, FALSE, 0);
1225 if (o_ptr->tval == TV_SWORD)
1228 act = "¤Ï±Ô¤µ¤òÁý¤·¤¿¡ª";
1230 act = "becomes very sharp!";
1233 o_ptr->name2 = EGO_SHARPNESS;
1234 o_ptr->pval = m_bonus(5, dun_level) + 1;
1239 act = "¤ÏÇ˲õÎϤòÁý¤·¤¿¡ª";
1241 act = "seems very powerful.";
1244 o_ptr->name2 = EGO_EARTHQUAKES;
1245 o_ptr->pval = m_bonus(3, dun_level);
1250 act = "¤ÏÅÅ·â¤Ëʤ¤ï¤ì¤¿¡ª";
1252 act = "coverd with lightning!";
1255 o_ptr->name2 = EGO_BRAND_ELEC;
1259 act = "¤Ï»À¤Ëʤ¤ï¤ì¤¿¡ª";
1261 act = "coated with acid!";
1264 o_ptr->name2 = EGO_BRAND_ACID;
1268 act = "¤Ï¼Ù°¤Ê¤ë²øʪ¤òµá¤á¤Æ¤¤¤ë¡ª";
1270 act = "seems looking for evil monster!";
1273 o_ptr->name2 = EGO_SLAY_EVIL;
1277 act = "¤Ï°ÛÀ¤³¦¤Î½»¿Í¤ÎÆùÂΤòµá¤á¤Æ¤¤¤ë¡ª";
1279 act = "seems looking for demon!";
1282 o_ptr->name2 = EGO_SLAY_DEMON;
1286 act = "¤Ï»Ó¤òµá¤á¤Æ¤¤¤ë¡ª";
1288 act = "seems looking for undead!";
1291 o_ptr->name2 = EGO_SLAY_UNDEAD;
1295 act = "¤Ïưʪ¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1297 act = "seems looking for animal!";
1300 o_ptr->name2 = EGO_SLAY_ANIMAL;
1304 act = "¤Ï¥É¥é¥´¥ó¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1306 act = "seems looking for dragon!";
1309 o_ptr->name2 = EGO_SLAY_DRAGON;
1313 act = "¤Ï¥È¥í¥ë¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1315 act = "seems looking for troll!";
1318 o_ptr->name2 = EGO_SLAY_TROLL;
1322 act = "¤Ï¥ª¡¼¥¯¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1324 act = "seems looking for orc!";
1327 o_ptr->name2 = EGO_SLAY_ORC;
1331 act = "¤Ïµð¿Í¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1333 act = "seems looking for giant!";
1336 o_ptr->name2 = EGO_SLAY_GIANT;
1340 act = "¤ÏÈó¾ï¤ËÉÔ°ÂÄê¤Ë¤Ê¤Ã¤¿¤è¤¦¤À¡£";
1342 act = "seems very unstable now.";
1345 o_ptr->name2 = EGO_TRUMP;
1346 o_ptr->pval = randint1(2);
1350 act = "¤Ï·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1352 act = "thirsts for blood!";
1355 o_ptr->name2 = EGO_VAMPIRIC;
1359 act = "¤ÏÆǤËʤ¤ï¤ì¤¿¡£";
1361 act = "is coated with poison.";
1364 o_ptr->name2 = EGO_BRAND_POIS;
1368 act = "¤Ï½ã¥í¥°¥ë¥¹¤Ë°û¤ß¹þ¤Þ¤ì¤¿¡£";
1370 act = "is engulfed in raw Logrus!";
1373 o_ptr->name2 = EGO_CHAOTIC;
1377 act = "¤Ï±ê¤Î¥·¡¼¥ë¥É¤Ëʤ¤ï¤ì¤¿¡ª";
1379 act = "is covered in a fiery shield!";
1382 o_ptr->name2 = EGO_BRAND_FIRE;
1386 act = "¤Ï¿¼¤¯Î䤿¤¤¥Ö¥ë¡¼¤Ëµ±¤¤¤¿¡ª";
1388 act = "glows deep, icy blue!";
1391 o_ptr->name2 = EGO_BRAND_COLD;
1396 msg_format("¤¢¤Ê¤¿¤Î%s%s", o_name, act);
1398 msg_format("Your %s %s", o_name, act);
1402 enchant(o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
1404 o_ptr->discount = 99;
1405 chg_virtue(V_ENCHANT, 2);
1409 if (flush_failure) flush();
1412 msg_print("°ÀÉղä˼ºÇÔ¤·¤¿¡£");
1414 msg_print("The Branding failed.");
1417 chg_virtue(V_ENCHANT, -2);
1423 void call_the_(void)
1427 if (cave_floor_bold(py - 1, px - 1) &&
1428 cave_floor_bold(py - 1, px ) &&
1429 cave_floor_bold(py - 1, px + 1) &&
1430 cave_floor_bold(py , px - 1) &&
1431 cave_floor_bold(py , px + 1) &&
1432 cave_floor_bold(py + 1, px - 1) &&
1433 cave_floor_bold(py + 1, px ) &&
1434 cave_floor_bold(py + 1, px + 1))
1436 for (i = 1; i < 10; i++)
1438 if (i-5) fire_ball(GF_ROCKET, i, 175, 2);
1441 for (i = 1; i < 10; i++)
1443 if (i-5) fire_ball(GF_MANA, i, 175, 3);
1446 for (i = 1; i < 10; i++)
1448 if (i-5) fire_ball(GF_NUKE, i, 175, 4);
1454 msg_format("¤¢¤Ê¤¿¤Ï%s¤òÊɤ˶᤹¤®¤ë¾ì½ê¤Ç¾§¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª",
1455 ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "µ§¤ê" : "¼öʸ"));
1456 msg_print("Â礤ÊÇúȯ²»¤¬¤¢¤Ã¤¿¡ª");
1458 msg_format("You %s the %s too close to a wall!",
1459 ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "recite" : "cast"),
1460 ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "prayer" : "spell"));
1461 msg_print("There is a loud explosion!");
1465 if (destroy_area(py, px, 15 + p_ptr->lev + randint0(11), TRUE))
1467 msg_print("¥À¥ó¥¸¥ç¥ó¤¬Êø²õ¤·¤¿...");
1469 msg_print("The dungeon collapses...");
1474 msg_print("¥À¥ó¥¸¥ç¥ó¤ÏÂ礤¯Íɤ줿¡£");
1476 msg_print("The dungeon trembles.");
1481 take_hit(DAMAGE_NOESCAPE, 100 + randint1(150), "¼«»¦Åª¤Êµõ̵¾·Íè", -1);
1483 take_hit(DAMAGE_NOESCAPE, 100 + randint1(150), "a suicidal Call the Void", -1);
1491 * Fetch an item (teleport it right underneath the caster)
1493 void fetch(int dir, int wgt, bool require_los)
1499 char o_name[MAX_NLEN];
1501 /* Check to see if an object is already there */
1502 if (cave[py][px].o_idx)
1505 msg_print("¼«Ê¬¤Î¤β¼¤Ë¤¢¤ëʪ¤Ï¼è¤ì¤Þ¤»¤ó¡£");
1507 msg_print("You can't fetch when you're already standing on something.");
1514 if (dir == 5 && target_okay())
1519 if (distance(py, px, ty, tx) > MAX_RANGE)
1522 msg_print("¤½¤ó¤Ê¤Ë±ó¤¯¤Ë¤¢¤ëʪ¤Ï¼è¤ì¤Þ¤»¤ó¡ª");
1524 msg_print("You can't fetch something that far away!");
1530 c_ptr = &cave[ty][tx];
1532 /* We need an item to fetch */
1536 msg_print("¤½¤³¤Ë¤Ï²¿¤â¤¢¤ê¤Þ¤»¤ó¡£");
1538 msg_print("There is no object at this place.");
1544 /* No fetching from vault */
1545 if (c_ptr->info & CAVE_ICKY)
1548 msg_print("¥¢¥¤¥Æ¥à¤¬¥³¥ó¥È¥í¡¼¥ë¤ò³°¤ì¤ÆÍî¤Á¤¿¡£");
1550 msg_print("The item slips from your control.");
1556 /* We need to see the item */
1557 if (require_los && !player_has_los_bold(ty, tx))
1560 msg_print("¤½¤³¤Ï¤¢¤Ê¤¿¤Î»ë³¦¤ËÆþ¤Ã¤Æ¤¤¤Þ¤»¤ó¡£");
1562 msg_print("You have no direct line of sight to that location.");
1570 /* Use a direction */
1571 ty = py; /* Where to drop the item */
1579 c_ptr = &cave[ty][tx];
1581 if ((distance(py, px, ty, tx) > MAX_RANGE) ||
1582 !cave_floor_bold(ty, tx)) return;
1584 while (!c_ptr->o_idx);
1587 o_ptr = &o_list[c_ptr->o_idx];
1589 if (o_ptr->weight > wgt)
1591 /* Too heavy to 'fetch' */
1593 msg_print("¤½¤Î¥¢¥¤¥Æ¥à¤Ï½Å²á¤®¤Þ¤¹¡£");
1595 msg_print("The object is too heavy.");
1602 c_ptr->o_idx = o_ptr->next_o_idx;
1603 cave[py][px].o_idx = i; /* 'move' it */
1604 o_ptr->next_o_idx = 0;
1605 o_ptr->iy = (byte)py;
1606 o_ptr->ix = (byte)px;
1608 object_desc(o_name, o_ptr, TRUE, 0);
1610 msg_format("%^s¤¬¤¢¤Ê¤¿¤Î¸µ¤ËÈô¤ó¤Ç¤¤¿¡£", o_name);
1612 msg_format("%^s flies through the air to your feet.", o_name);
1617 p_ptr->redraw |= PR_MAP;
1621 void alter_reality(void)
1623 if (!quest_number(dun_level) && dun_level)
1626 msg_print("À¤³¦¤¬ÊѤï¤Ã¤¿¡ª");
1628 msg_print("The world changes!");
1632 if (autosave_l) do_cmd_save_game(TRUE);
1635 p_ptr->leaving = TRUE;
1640 msg_print("À¤³¦¤¬¾¯¤·¤Î´ÖÊѲ½¤·¤¿¤è¤¦¤À¡£");
1642 msg_print("The world seems to change for a moment!");
1650 * Leave a "glyph of warding" which prevents monster movement
1652 bool warding_glyph(void)
1655 if (!cave_clean_bold(py, px))
1658 msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£");
1660 msg_print("The object resists the spell.");
1666 /* Create a glyph */
1667 cave_set_feat(py, px, FEAT_GLYPH);
1672 bool warding_mirror(void)
1675 if (!cave_clean_bold(py, px))
1678 msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£");
1680 msg_print("The object resists the spell.");
1686 /* Create a glyph */
1687 cave_set_feat(py, px, FEAT_MIRROR);
1696 * Leave an "explosive rune" which prevents monster movement
1698 bool explosive_rune(void)
1701 if (!cave_clean_bold(py, px))
1704 msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£");
1706 msg_print("The object resists the spell.");
1712 /* Create a glyph */
1713 cave_set_feat(py, px, FEAT_MINOR_GLYPH);
1720 * Identify everything being carried.
1721 * Done by a potion of "self knowledge".
1723 void identify_pack(void)
1727 /* Simply identify and know every item */
1728 for (i = 0; i < INVEN_TOTAL; i++)
1730 object_type *o_ptr = &inventory[i];
1732 /* Skip non-objects */
1733 if (!o_ptr->k_idx) continue;
1736 identify_item(o_ptr);
1742 * Used by the "enchant" function (chance of failure)
1743 * (modified for Zangband, we need better stuff there...) -- TY
1745 static int enchant_table[16] =
1747 0, 10, 50, 100, 200,
1748 300, 400, 500, 650, 800,
1749 950, 987, 993, 995, 998,
1755 * Removes curses from items in inventory
1757 * Note that Items which are "Perma-Cursed" (The One Ring,
1758 * The Crown of Morgoth) can NEVER be uncursed.
1760 * Note that if "all" is FALSE, then Items which are
1761 * "Heavy-Cursed" (Mormegil, Calris, and Weapons of Morgul)
1762 * will not be uncursed.
1764 static int remove_curse_aux(int all)
1768 /* Attempt to uncurse items being worn */
1769 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1773 object_type *o_ptr = &inventory[i];
1775 /* Skip non-objects */
1776 if (!o_ptr->k_idx) continue;
1778 /* Uncursed already */
1779 if (!cursed_p(o_ptr)) continue;
1781 /* Extract the flags */
1782 object_flags(o_ptr, &f1, &f2, &f3);
1784 /* Heavily Cursed Items need a special spell */
1785 if (!all && (f3 & TR3_HEAVY_CURSE)) continue;
1787 /* Perma-Cursed Items can NEVER be uncursed */
1788 if (f3 & TR3_PERMA_CURSE) continue;
1791 o_ptr->ident &= ~(IDENT_CURSED);
1793 /* Hack -- Assume felt */
1794 o_ptr->ident |= (IDENT_SENSE);
1796 if (o_ptr->art_flags3 & TR3_CURSED)
1797 o_ptr->art_flags3 &= ~(TR3_CURSED);
1799 if (o_ptr->art_flags3 & TR3_HEAVY_CURSE)
1800 o_ptr->art_flags3 &= ~(TR3_HEAVY_CURSE);
1803 o_ptr->feeling = FEEL_NONE;
1805 /* Recalculate the bonuses */
1806 p_ptr->update |= (PU_BONUS);
1809 p_ptr->window |= (PW_EQUIP);
1811 /* Count the uncursings */
1815 /* Return "something uncursed" */
1821 * Remove most curses
1823 bool remove_curse(void)
1825 return (remove_curse_aux(FALSE));
1831 bool remove_all_curse(void)
1833 return (remove_curse_aux(TRUE));
1838 * Turns an object into gold, gain some of its value in a shop
1847 char o_name[MAX_NLEN];
1848 char out_val[MAX_NLEN+40];
1852 /* Hack -- force destruction */
1853 if (command_arg > 0) force = TRUE;
1857 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò¶â¤ËÊѤ¨¤Þ¤¹¤«¡©";
1858 s = "¶â¤ËÊѤ¨¤é¤ì¤ëʪ¤¬¤¢¤ê¤Þ¤»¤ó¡£";
1860 q = "Turn which item to gold? ";
1861 s = "You have nothing to turn to gold.";
1864 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return (FALSE);
1866 /* Get the item (in the pack) */
1869 o_ptr = &inventory[item];
1872 /* Get the item (on the floor) */
1875 o_ptr = &o_list[0 - item];
1879 /* See how many items */
1880 if (o_ptr->number > 1)
1882 /* Get a quantity */
1883 amt = get_quantity(NULL, o_ptr->number);
1885 /* Allow user abort */
1886 if (amt <= 0) return FALSE;
1890 /* Describe the object */
1891 old_number = o_ptr->number;
1892 o_ptr->number = amt;
1893 object_desc(o_name, o_ptr, TRUE, 3);
1894 o_ptr->number = old_number;
1896 /* Verify unless quantity given */
1899 if (confirm_destroy || (object_value(o_ptr) > 0))
1901 /* Make a verification */
1903 sprintf(out_val, "ËÜÅö¤Ë%s¤ò¶â¤ËÊѤ¨¤Þ¤¹¤«¡©", o_name);
1905 sprintf(out_val, "Really turn %s to gold? ", o_name);
1908 if (!get_check(out_val)) return FALSE;
1912 /* Artifacts cannot be destroyed */
1913 if (artifact_p(o_ptr) || o_ptr->art_name)
1915 byte feel = FEEL_SPECIAL;
1919 msg_format("%s¤ò¶â¤ËÊѤ¨¤ë¤³¤È¤Ë¼ºÇÔ¤·¤¿¡£", o_name);
1921 msg_format("You fail to turn %s to gold!", o_name);
1925 /* Hack -- Handle icky artifacts */
1926 if (cursed_p(o_ptr) || broken_p(o_ptr)) feel = FEEL_TERRIBLE;
1928 /* Hack -- inscribe the artifact */
1929 o_ptr->feeling = feel;
1931 /* We have "felt" it (again) */
1932 o_ptr->ident |= (IDENT_SENSE);
1934 /* Combine the pack */
1935 p_ptr->notice |= (PN_COMBINE);
1938 p_ptr->window |= (PW_INVEN | PW_EQUIP);
1944 price = object_value_real(o_ptr);
1950 msg_format("%s¤ò¥Ë¥»¤Î¶â¤ËÊѤ¨¤¿¡£", o_name);
1952 msg_format("You turn %s to fool's gold.", o_name);
1960 if (amt > 1) price *= amt;
1962 if (price > 30000) price = 30000;
1964 msg_format("%s¤ò¡ð%d ¤Î¶â¤ËÊѤ¨¤¿¡£", o_name, price);
1966 msg_format("You turn %s to %ld coins worth of gold.", o_name, price);
1972 p_ptr->redraw |= (PR_GOLD);
1975 p_ptr->window |= (PW_PLAYER);
1979 /* Eliminate the item (from the pack) */
1982 inven_item_increase(item, -amt);
1983 inven_item_describe(item);
1984 inven_item_optimize(item);
1987 /* Eliminate the item (from the floor) */
1990 floor_item_increase(0 - item, -amt);
1991 floor_item_describe(0 - item);
1992 floor_item_optimize(0 - item);
2000 * Create stairs at the player location
2002 void stair_creation(void)
2005 if (!cave_valid_bold(py, px))
2008 msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£");
2010 msg_print("The object resists the spell.");
2017 delete_object(py, px);
2019 /* Create a staircase */
2020 if (p_ptr->inside_arena || (p_ptr->inside_quest && (p_ptr->inside_quest < MIN_RANDOM_QUEST)) || p_ptr->inside_battle || !dun_level)
2022 /* arena or quest */
2024 msg_print("¸ú²Ì¤¬¤¢¤ê¤Þ¤»¤ó¡ª");
2026 msg_print("There is no effect!");
2030 else if (ironman_downward)
2032 /* Town/wilderness or Ironman */
2033 cave_set_feat(py, px, FEAT_MORE);
2035 else if (quest_number(dun_level) || (dun_level >= d_info[dungeon_type].maxdepth))
2038 cave_set_feat(py, px, FEAT_LESS);
2040 else if (randint0(100) < 50)
2042 cave_set_feat(py, px, FEAT_MORE);
2046 cave_set_feat(py, px, FEAT_LESS);
2052 * Hook to specify "weapon"
2054 bool item_tester_hook_weapon(object_type *o_ptr)
2056 switch (o_ptr->tval)
2070 if (o_ptr->sval != SV_DOKUBARI) return (TRUE);
2077 bool item_tester_hook_weapon2(object_type *o_ptr)
2079 switch (o_ptr->tval)
2099 * Hook to specify "armour"
2101 bool item_tester_hook_armour(object_type *o_ptr)
2103 switch (o_ptr->tval)
2123 bool item_tester_hook_corpse(object_type *o_ptr)
2125 switch (o_ptr->tval)
2138 * Check if an object is weapon or armour (but not arrow, bolt, or shot)
2140 bool item_tester_hook_weapon_armour(object_type *o_ptr)
2142 switch (o_ptr->tval)
2171 * Check if an object is nameless weapon or armour
2173 bool item_tester_hook_nameless_weapon_armour(object_type *o_ptr)
2175 if (o_ptr->name1 || o_ptr->art_name || o_ptr->name2 || o_ptr->xtra3)
2178 switch (o_ptr->tval)
2207 * Break the curse of an item
2209 static void break_curse(object_type *o_ptr)
2213 /* Extract the flags */
2214 object_flags(o_ptr, &f1, &f2, &f3);
2216 if (cursed_p(o_ptr) && !(f3 & TR3_PERMA_CURSE) && !(f3 & TR3_HEAVY_CURSE) && (randint0(100) < 25))
2219 msg_print("¤«¤±¤é¤ì¤Æ¤¤¤¿¼ö¤¤¤¬ÂǤÁÇˤé¤ì¤¿¡ª");
2221 msg_print("The curse is broken!");
2225 o_ptr->ident &= ~(IDENT_CURSED);
2226 o_ptr->ident |= (IDENT_SENSE);
2228 if (o_ptr->art_flags3 & TR3_CURSED)
2229 o_ptr->art_flags3 &= ~(TR3_CURSED);
2231 o_ptr->feeling = FEEL_NONE;
2237 * Enchants a plus onto an item. -RAK-
2239 * Revamped! Now takes item pointer, number of times to try enchanting,
2240 * and a flag of what to try enchanting. Artifacts resist enchantment
2241 * some of the time, and successful enchantment to at least +0 might
2242 * break a curse on the item. -CFT-
2244 * Note that an item can technically be enchanted all the way to +15 if
2245 * you wait a very, very, long time. Going from +9 to +10 only works
2246 * about 5% of the time, and from +10 to +11 only about 1% of the time.
2248 * Note that this function can now be used on "piles" of items, and
2249 * the larger the pile, the lower the chance of success.
2251 bool enchant(object_type *o_ptr, int n, int eflag)
2253 int i, chance, prob;
2255 bool a = (artifact_p(o_ptr) || o_ptr->art_name);
2256 bool force = (eflag & ENCH_FORCE);
2259 /* Large piles resist enchantment */
2260 prob = o_ptr->number * 100;
2262 /* Missiles are easy to enchant */
2263 if ((o_ptr->tval == TV_BOLT) ||
2264 (o_ptr->tval == TV_ARROW) ||
2265 (o_ptr->tval == TV_SHOT))
2271 for (i = 0; i < n; i++)
2273 /* Hack -- Roll for pile resistance */
2274 if (!force && randint0(prob) >= 100) continue;
2276 /* Enchant to hit */
2277 if (eflag & ENCH_TOHIT)
2279 if (o_ptr->to_h < 0) chance = 0;
2280 else if (o_ptr->to_h > 15) chance = 1000;
2281 else chance = enchant_table[o_ptr->to_h];
2283 if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
2288 /* only when you get it above -1 -CFT */
2289 if (o_ptr->to_h >= 0)
2294 /* Enchant to damage */
2295 if (eflag & ENCH_TODAM)
2297 if (o_ptr->to_d < 0) chance = 0;
2298 else if (o_ptr->to_d > 15) chance = 1000;
2299 else chance = enchant_table[o_ptr->to_d];
2301 if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
2306 /* only when you get it above -1 -CFT */
2307 if (o_ptr->to_d >= 0)
2312 /* Enchant to armor class */
2313 if (eflag & ENCH_TOAC)
2315 if (o_ptr->to_a < 0) chance = 0;
2316 else if (o_ptr->to_a > 15) chance = 1000;
2317 else chance = enchant_table[o_ptr->to_a];
2319 if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
2324 /* only when you get it above -1 -CFT */
2325 if (o_ptr->to_a >= 0)
2332 if (!res) return (FALSE);
2334 /* Recalculate bonuses */
2335 p_ptr->update |= (PU_BONUS);
2337 /* Combine / Reorder the pack (later) */
2338 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2341 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2352 * Enchant an item (in the inventory or on the floor)
2353 * Note that "num_ac" requires armour, else weapon
2354 * Returns TRUE if attempted, FALSE if cancelled
2356 bool enchant_spell(int num_hit, int num_dam, int num_ac)
2361 char o_name[MAX_NLEN];
2365 /* Assume enchant weapon */
2366 item_tester_hook = item_tester_hook_weapon;
2367 item_tester_no_ryoute = TRUE;
2369 /* Enchant armor if requested */
2370 if (num_ac) item_tester_hook = item_tester_hook_armour;
2374 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò¶¯²½¤·¤Þ¤¹¤«? ";
2375 s = "¶¯²½¤Ç¤¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2377 q = "Enchant which item? ";
2378 s = "You have nothing to enchant.";
2381 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2383 /* Get the item (in the pack) */
2386 o_ptr = &inventory[item];
2389 /* Get the item (on the floor) */
2392 o_ptr = &o_list[0 - item];
2397 object_desc(o_name, o_ptr, FALSE, 0);
2401 msg_format("%s ¤ÏÌÀ¤ë¤¯µ±¤¤¤¿¡ª",
2404 msg_format("%s %s glow%s brightly!",
2405 ((item >= 0) ? "Your" : "The"), o_name,
2406 ((o_ptr->number > 1) ? "" : "s"));
2411 if (enchant(o_ptr, num_hit, ENCH_TOHIT)) okay = TRUE;
2412 if (enchant(o_ptr, num_dam, ENCH_TODAM)) okay = TRUE;
2413 if (enchant(o_ptr, num_ac, ENCH_TOAC)) okay = TRUE;
2419 if (flush_failure) flush();
2423 msg_print("¶¯²½¤Ë¼ºÇÔ¤·¤¿¡£");
2425 msg_print("The enchantment failed.");
2428 if (one_in_(3)) chg_virtue(V_ENCHANT, -1);
2431 chg_virtue(V_ENCHANT, 1);
2435 /* Something happened */
2440 bool artifact_scroll(void)
2445 char o_name[MAX_NLEN];
2449 item_tester_no_ryoute = TRUE;
2450 /* Enchant weapon/armour */
2451 item_tester_hook = item_tester_hook_nameless_weapon_armour;
2455 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò¶¯²½¤·¤Þ¤¹¤«? ";
2456 s = "¶¯²½¤Ç¤¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2458 q = "Enchant which item? ";
2459 s = "You have nothing to enchant.";
2462 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2464 /* Get the item (in the pack) */
2467 o_ptr = &inventory[item];
2470 /* Get the item (on the floor) */
2473 o_ptr = &o_list[0 - item];
2478 object_desc(o_name, o_ptr, FALSE, 0);
2482 msg_format("%s ¤ÏâÁ¤¤¸÷¤òȯ¤·¤¿¡ª",o_name);
2484 msg_format("%s %s radiate%s a blinding light!",
2485 ((item >= 0) ? "Your" : "The"), o_name,
2486 ((o_ptr->number > 1) ? "" : "s"));
2489 if (o_ptr->name1 || o_ptr->art_name)
2492 msg_format("%s¤Ï´û¤ËÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Ç¤¹¡ª",
2495 msg_format("The %s %s already %s!",
2496 o_name, ((o_ptr->number > 1) ? "are" : "is"),
2497 ((o_ptr->number > 1) ? "artifacts" : "an artifact"));
2503 else if (o_ptr->name2)
2506 msg_format("%s¤Ï´û¤Ë̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à¤Ç¤¹¡ª",
2509 msg_format("The %s %s already %s!",
2510 o_name, ((o_ptr->number > 1) ? "are" : "is"),
2511 ((o_ptr->number > 1) ? "ego items" : "an ego item"));
2517 else if (o_ptr->xtra3)
2520 msg_format("%s¤Ï´û¤Ë¶¯²½¤µ¤ì¤Æ¤¤¤Þ¤¹¡ª",
2523 msg_format("The %s %s already %s!",
2524 o_name, ((o_ptr->number > 1) ? "are" : "is"),
2525 ((o_ptr->number > 1) ? "kaji items" : "an kaji item"));
2531 if (o_ptr->number > 1)
2534 msg_print("Ê£¿ô¤Î¥¢¥¤¥Æ¥à¤ËËâË¡¤ò¤«¤±¤ë¤À¤±¤Î¥¨¥Í¥ë¥®¡¼¤Ï¤¢¤ê¤Þ¤»¤ó¡ª");
2535 msg_format("%d ¸Ä¤Î%s¤¬²õ¤ì¤¿¡ª",(o_ptr->number)-1, o_name);
2537 msg_print("Not enough enough energy to enchant more than one object!");
2538 msg_format("%d of your %s %s destroyed!",(o_ptr->number)-1, o_name, (o_ptr->number>2?"were":"was"));
2543 inven_item_increase(item, 1-(o_ptr->number));
2547 floor_item_increase(0-item, 1-(o_ptr->number));
2550 okay = create_artifact(o_ptr, TRUE);
2557 if (flush_failure) flush();
2561 msg_print("¶¯²½¤Ë¼ºÇÔ¤·¤¿¡£");
2563 msg_print("The enchantment failed.");
2566 if (one_in_(3)) chg_virtue(V_ENCHANT, -1);
2569 chg_virtue(V_ENCHANT, 1);
2573 /* Something happened */
2579 * Identify an object
2581 void identify_item(object_type *o_ptr)
2583 bool motoart = TRUE;
2584 char o_name[MAX_NLEN];
2587 object_desc(o_name, o_ptr, TRUE, 3);
2589 if ((artifact_p(o_ptr) || o_ptr->art_name) && !(o_ptr->ident & IDENT_KNOWN))
2592 if (!(o_ptr->ident & (IDENT_MENTAL)))
2594 if ((o_ptr->art_name) || (artifact_p(o_ptr)) || one_in_(5))
2595 chg_virtue(V_KNOWLEDGE, 1);
2598 /* Identify it fully */
2599 object_aware(o_ptr);
2600 object_known(o_ptr);
2602 /* Recalculate bonuses */
2603 p_ptr->update |= (PU_BONUS);
2605 /* Combine / Reorder the pack (later) */
2606 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2609 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2611 strcpy(record_o_name, o_name);
2615 object_desc(o_name, o_ptr, TRUE, 0);
2617 if(record_fix_art && !motoart && artifact_p(o_ptr))
2618 do_cmd_write_nikki(NIKKI_ART, 0, o_name);
2619 if(record_rand_art && !motoart && o_ptr->art_name)
2620 do_cmd_write_nikki(NIKKI_ART, 0, o_name);
2624 bool item_tester_hook_identify(object_type *o_ptr)
2626 return (bool)!object_known_p(o_ptr);
2629 bool item_tester_hook_identify_weapon_armour(object_type *o_ptr)
2631 if (object_known_p(o_ptr))
2633 return item_tester_hook_weapon_armour(o_ptr);
2637 * Identify an object in the inventory (or on the floor)
2638 * This routine does *not* automatically combine objects.
2639 * Returns TRUE if something was identified, else FALSE.
2641 bool ident_spell(bool only_equip)
2645 char o_name[MAX_NLEN];
2648 item_tester_no_ryoute = TRUE;
2651 item_tester_hook = item_tester_hook_identify_weapon_armour;
2653 item_tester_hook = item_tester_hook_identify;
2655 if (!can_get_item())
2659 item_tester_hook = item_tester_hook_weapon_armour;
2663 item_tester_hook = NULL;
2669 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò´ÕÄꤷ¤Þ¤¹¤«? ";
2670 s = "´ÕÄꤹ¤ë¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2672 q = "Identify which item? ";
2673 s = "You have nothing to identify.";
2676 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2678 /* Get the item (in the pack) */
2681 o_ptr = &inventory[item];
2684 /* Get the item (on the floor) */
2687 o_ptr = &o_list[0 - item];
2691 identify_item(o_ptr);
2694 object_desc(o_name, o_ptr, TRUE, 3);
2697 if (item >= INVEN_RARM)
2700 msg_format("%^s: %s(%c)¡£",
2702 msg_format("%^s: %s (%c).",
2705 describe_use(item), o_name, index_to_label(item));
2710 msg_format("¥¶¥Ã¥¯Ãæ: %s(%c)¡£",
2712 msg_format("In your pack: %s (%c).",
2715 o_name, index_to_label(item));
2720 msg_format("¾²¾å: %s¡£",
2722 msg_format("On the ground: %s.",
2728 /* Something happened */
2734 * Mundanify an object in the inventory (or on the floor)
2735 * This routine does *not* automatically combine objects.
2736 * Returns TRUE if something was mundanified, else FALSE.
2738 bool mundane_spell(bool only_equip)
2744 if (only_equip) item_tester_hook = item_tester_hook_weapon_armour;
2745 item_tester_no_ryoute = TRUE;
2749 q = "¤É¤ì¤ò»È¤¤¤Þ¤¹¤«¡©";
2750 s = "»È¤¨¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
2752 q = "Use which item? ";
2753 s = "You have nothing you can use.";
2756 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2758 /* Get the item (in the pack) */
2761 o_ptr = &inventory[item];
2764 /* Get the item (on the floor) */
2767 o_ptr = &o_list[0 - item];
2772 msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
2774 msg_print("There is a bright flash of light!");
2777 byte iy = o_ptr->iy; /* Y-position on map, or zero */
2778 byte ix = o_ptr->ix; /* X-position on map, or zero */
2779 s16b next_o_idx= o_ptr->next_o_idx; /* Next object in stack (if any) */
2780 byte marked=o_ptr->marked; /* Object is marked */
2781 s16b weight = (o_ptr->number*o_ptr->weight);
2784 object_prep(o_ptr, o_ptr->k_idx);
2788 o_ptr->next_o_idx=next_o_idx;
2789 o_ptr->marked=marked;
2790 if (item >= 0) p_ptr->total_weight += (o_ptr->weight - weight);
2794 /* Something happened */
2800 bool item_tester_hook_identify_fully(object_type *o_ptr)
2802 return (bool)(!object_known_p(o_ptr) || !(o_ptr->ident & IDENT_MENTAL));
2805 bool item_tester_hook_identify_fully_weapon_armour(object_type *o_ptr)
2807 if (!item_tester_hook_identify_fully(o_ptr))
2809 return item_tester_hook_weapon_armour(o_ptr);
2813 * Fully "identify" an object in the inventory -BEN-
2814 * This routine returns TRUE if an item was identified.
2816 bool identify_fully(bool only_equip)
2820 char o_name[MAX_NLEN];
2823 item_tester_no_ryoute = TRUE;
2825 item_tester_hook = item_tester_hook_identify_fully_weapon_armour;
2827 item_tester_hook = item_tester_hook_identify_fully;
2829 if (!can_get_item())
2832 item_tester_hook = item_tester_hook_weapon_armour;
2834 item_tester_hook = NULL;
2839 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò´ÕÄꤷ¤Þ¤¹¤«? ";
2840 s = "´ÕÄꤹ¤ë¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2842 q = "Identify which item? ";
2843 s = "You have nothing to identify.";
2846 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2848 /* Get the item (in the pack) */
2851 o_ptr = &inventory[item];
2854 /* Get the item (on the floor) */
2857 o_ptr = &o_list[0 - item];
2861 identify_item(o_ptr);
2863 /* Mark the item as fully known */
2864 o_ptr->ident |= (IDENT_MENTAL);
2870 object_desc(o_name, o_ptr, TRUE, 3);
2873 if (item >= INVEN_RARM)
2876 msg_format("%^s: %s(%c)¡£",
2878 msg_format("%^s: %s (%c).",
2881 describe_use(item), o_name, index_to_label(item));
2886 msg_format("¥¶¥Ã¥¯Ãæ: %s(%c)¡£",
2888 msg_format("In your pack: %s (%c).",
2891 o_name, index_to_label(item));
2896 msg_format("¾²¾å: %s¡£",
2898 msg_format("On the ground: %s.",
2904 /* Describe it fully */
2905 (void)identify_fully_aux(o_ptr);
2915 * Hook for "get_item()". Determine if something is rechargable.
2917 bool item_tester_hook_recharge(object_type *o_ptr)
2919 /* Recharge staffs */
2920 if (o_ptr->tval == TV_STAFF) return (TRUE);
2922 /* Recharge wands */
2923 if (o_ptr->tval == TV_WAND) return (TRUE);
2925 /* Hack -- Recharge rods */
2926 if (o_ptr->tval == TV_ROD) return (TRUE);
2934 * Recharge a wand/staff/rod from the pack or on the floor.
2935 * This function has been rewritten in Oangband and ZAngband.
2937 * Sorcery/Arcane -- Recharge --> recharge(plev * 4)
2938 * Chaos -- Arcane Binding --> recharge(90)
2940 * Scroll of recharging --> recharge(130)
2941 * Artifact activation/Thingol --> recharge(130)
2943 * It is harder to recharge high level, and highly charged wands,
2944 * staffs, and rods. The more wands in a stack, the more easily and
2945 * strongly they recharge. Staffs, however, each get fewer charges if
2948 * XXX XXX XXX Beware of "sliding index errors".
2950 bool recharge(int power)
2953 int recharge_strength, recharge_amount;
2962 char o_name[MAX_NLEN];
2964 /* Only accept legal items */
2965 item_tester_hook = item_tester_hook_recharge;
2969 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ËËâÎϤò½¼Å¶¤·¤Þ¤¹¤«? ";
2970 s = "ËâÎϤò½¼Å¶¤¹¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2972 q = "Recharge which item? ";
2973 s = "You have nothing to recharge.";
2976 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return (FALSE);
2978 /* Get the item (in the pack) */
2981 o_ptr = &inventory[item];
2984 /* Get the item (on the floor) */
2987 o_ptr = &o_list[0 - item];
2990 /* Get the object kind. */
2991 k_ptr = &k_info[o_ptr->k_idx];
2993 /* Extract the object "level" */
2994 lev = get_object_level(o_ptr);
2997 /* Recharge a rod */
2998 if (o_ptr->tval == TV_ROD)
3000 /* Extract a recharge strength by comparing object level to power. */
3001 recharge_strength = ((power > lev/2) ? (power - lev/2) : 0) / 5;
3005 if (one_in_(recharge_strength))
3007 /* Activate the failure code. */
3014 /* Recharge amount */
3015 recharge_amount = (power * damroll(3, 2));
3017 /* Recharge by that amount */
3018 if (o_ptr->timeout > recharge_amount)
3019 o_ptr->timeout -= recharge_amount;
3026 /* Recharge wand/staff */
3029 /* Extract a recharge strength by comparing object level to power.
3030 * Divide up a stack of wands' charges to calculate charge penalty.
3032 if ((o_ptr->tval == TV_WAND) && (o_ptr->number > 1))
3033 recharge_strength = (100 + power - lev -
3034 (8 * o_ptr->pval / o_ptr->number)) / 15;
3036 /* All staffs, unstacked wands. */
3037 else recharge_strength = (100 + power - lev -
3038 (8 * o_ptr->pval)) / 15;
3041 if (recharge_strength < 0) recharge_strength = 0;
3044 if (one_in_(recharge_strength))
3046 /* Activate the failure code. */
3050 /* If the spell didn't backfire, recharge the wand or staff. */
3053 /* Recharge based on the standard number of charges. */
3054 recharge_amount = randint1(1 + k_ptr->pval / 2);
3056 /* Multiple wands in a stack increase recharging somewhat. */
3057 if ((o_ptr->tval == TV_WAND) && (o_ptr->number > 1))
3060 (randint1(recharge_amount * (o_ptr->number - 1))) / 2;
3061 if (recharge_amount < 1) recharge_amount = 1;
3062 if (recharge_amount > 12) recharge_amount = 12;
3065 /* But each staff in a stack gets fewer additional charges,
3066 * although always at least one.
3068 if ((o_ptr->tval == TV_STAFF) && (o_ptr->number > 1))
3070 recharge_amount /= o_ptr->number;
3071 if (recharge_amount < 1) recharge_amount = 1;
3074 /* Recharge the wand or staff. */
3075 o_ptr->pval += recharge_amount;
3078 /* Hack -- we no longer "know" the item */
3079 o_ptr->ident &= ~(IDENT_KNOWN);
3081 /* Hack -- we no longer think the item is empty */
3082 o_ptr->ident &= ~(IDENT_EMPTY);
3087 /* Inflict the penalties for failing a recharge. */
3090 /* Artifacts are never destroyed. */
3091 if (artifact_p(o_ptr))
3093 object_desc(o_name, o_ptr, TRUE, 0);
3095 msg_format("ËâÎϤ¬µÕή¤·¤¿¡ª%s¤Ï´°Á´¤ËËâÎϤò¼º¤Ã¤¿¡£", o_name);
3097 msg_format("The recharging backfires - %s is completely drained!", o_name);
3101 /* Artifact rods. */
3102 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout < 10000))
3103 o_ptr->timeout = (o_ptr->timeout + 100) * 2;
3105 /* Artifact wands and staffs. */
3106 else if ((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_STAFF))
3111 /* Get the object description */
3112 object_desc(o_name, o_ptr, FALSE, 0);
3114 /*** Determine Seriousness of Failure ***/
3116 /* Mages recharge objects more safely. */
3117 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)
3119 /* 10% chance to blow up one rod, otherwise draining. */
3120 if (o_ptr->tval == TV_ROD)
3122 if (one_in_(10)) fail_type = 2;
3125 /* 75% chance to blow up one wand, otherwise draining. */
3126 else if (o_ptr->tval == TV_WAND)
3128 if (!one_in_(3)) fail_type = 2;
3131 /* 50% chance to blow up one staff, otherwise no effect. */
3132 else if (o_ptr->tval == TV_STAFF)
3134 if (one_in_(2)) fail_type = 2;
3139 /* All other classes get no special favors. */
3142 /* 33% chance to blow up one rod, otherwise draining. */
3143 if (o_ptr->tval == TV_ROD)
3145 if (one_in_(3)) fail_type = 2;
3148 /* 20% chance of the entire stack, else destroy one wand. */
3149 else if (o_ptr->tval == TV_WAND)
3151 if (one_in_(5)) fail_type = 3;
3154 /* Blow up one staff. */
3155 else if (o_ptr->tval == TV_STAFF)
3161 /*** Apply draining and destruction. ***/
3163 /* Drain object or stack of objects. */
3166 if (o_ptr->tval == TV_ROD)
3169 msg_print("ËâÎϤòµÛ¤¤¼è¤ë¤Î¤Ë¼ºÇÔ¤·¤¿¡£¥í¥Ã¥É¤ÎËâÎϤÏÁ´¤Æȯ»¶¤·¤Æ¤·¤Þ¤Ã¤¿¡£");
3171 msg_print("You failed to absorb magic power. All magic power of your rod had gone!");
3174 if (o_ptr->timeout < 10000)
3175 o_ptr->timeout = (o_ptr->timeout + 100) * 2;
3177 else if (o_ptr->tval == TV_WAND)
3180 msg_format("%s¤ÏÇË»¤òÌȤ줿¤¬¡¢ËâÎϤ¬Á´¤Æ¼º¤ï¤ì¤¿¡£", o_name);
3182 msg_format("You save your %s from destruction, but all charges are lost.", o_name);
3187 /* Staffs aren't drained. */
3190 /* Destroy an object or one in a stack of objects. */
3193 if (o_ptr->number > 1)
3195 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬°ìËܲõ¤ì¤¿¡ª", o_name);
3197 msg_format("Wild magic consumes one of your %s!", o_name);
3202 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²õ¤ì¤¿¡ª", o_name);
3204 msg_format("Wild magic consumes your %s!", o_name);
3208 /* Reduce rod stack maximum timeout, drain wands. */
3209 if (o_ptr->tval == TV_ROD) o_ptr->timeout = (o_ptr->number - 1) * k_ptr->pval;
3210 if (o_ptr->tval == TV_WAND) o_ptr->pval = 0;
3212 /* Reduce and describe inventory */
3215 inven_item_increase(item, -1);
3216 inven_item_describe(item);
3217 inven_item_optimize(item);
3220 /* Reduce and describe floor item */
3223 floor_item_increase(0 - item, -1);
3224 floor_item_describe(0 - item);
3225 floor_item_optimize(0 - item);
3229 /* Destroy all members of a stack of objects. */
3232 if (o_ptr->number > 1)
3234 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬Á´¤Æ²õ¤ì¤¿¡ª", o_name);
3236 msg_format("Wild magic consumes all your %s!", o_name);
3241 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²õ¤ì¤¿¡ª", o_name);
3243 msg_format("Wild magic consumes your %s!", o_name);
3248 /* Reduce and describe inventory */
3251 inven_item_increase(item, -999);
3252 inven_item_describe(item);
3253 inven_item_optimize(item);
3256 /* Reduce and describe floor item */
3259 floor_item_increase(0 - item, -999);
3260 floor_item_describe(0 - item);
3261 floor_item_optimize(0 - item);
3267 /* Combine / Reorder the pack (later) */
3268 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
3271 p_ptr->window |= (PW_INVEN);
3273 /* Something was done */
3281 bool bless_weapon(void)
3286 char o_name[MAX_NLEN];
3289 item_tester_no_ryoute = TRUE;
3290 /* Assume enchant weapon */
3291 item_tester_hook = item_tester_hook_weapon2;
3295 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò½ËÊ¡¤·¤Þ¤¹¤«¡©";
3296 s = "½ËÊ¡¤Ç¤¤ëÉð´ï¤¬¤¢¤ê¤Þ¤»¤ó¡£";
3298 q = "Bless which weapon? ";
3299 s = "You have weapon to bless.";
3302 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR)))
3305 /* Get the item (in the pack) */
3308 o_ptr = &inventory[item];
3311 /* Get the item (on the floor) */
3314 o_ptr = &o_list[0 - item];
3319 object_desc(o_name, o_ptr, FALSE, 0);
3321 /* Extract the flags */
3322 object_flags(o_ptr, &f1, &f2, &f3);
3324 if (o_ptr->ident & IDENT_CURSED)
3326 if (((f3 & TR3_HEAVY_CURSE) && (randint1(100) < 33)) ||
3327 (f3 & TR3_PERMA_CURSE))
3330 msg_format("%s¤òʤ¤¦¹õ¤¤¥ª¡¼¥é¤Ï½ËÊ¡¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
3333 msg_format("The black aura on %s %s disrupts the blessing!",
3334 ((item >= 0) ? "your" : "the"), o_name);
3341 msg_format("%s ¤«¤é¼Ù°¤Ê¥ª¡¼¥é¤¬¾Ã¤¨¤¿¡£",
3344 msg_format("A malignant aura leaves %s %s.",
3345 ((item >= 0) ? "your" : "the"), o_name);
3350 o_ptr->ident &= ~(IDENT_CURSED);
3352 /* Hack -- Assume felt */
3353 o_ptr->ident |= (IDENT_SENSE);
3356 o_ptr->feeling = FEEL_NONE;
3358 /* Recalculate the bonuses */
3359 p_ptr->update |= (PU_BONUS);
3362 p_ptr->window |= (PW_EQUIP);
3366 * Next, we try to bless it. Artifacts have a 1/3 chance of
3367 * being blessed, otherwise, the operation simply disenchants
3368 * them, godly power negating the magic. Ok, the explanation
3369 * is silly, but otherwise priests would always bless every
3370 * artifact weapon they find. Ego weapons and normal weapons
3371 * can be blessed automatically.
3373 if (f3 & TR3_BLESSED)
3376 msg_format("%s ¤Ï´û¤Ë½ËÊ¡¤µ¤ì¤Æ¤¤¤ë¡£",
3379 msg_format("%s %s %s blessed already.",
3380 ((item >= 0) ? "Your" : "The"), o_name,
3381 ((o_ptr->number > 1) ? "were" : "was"));
3387 if (!(o_ptr->art_name || o_ptr->name1 || o_ptr->name2) || one_in_(3))
3391 msg_format("%s¤Ïµ±¤¤¤¿¡ª",
3394 msg_format("%s %s shine%s!",
3395 ((item >= 0) ? "Your" : "The"), o_name,
3396 ((o_ptr->number > 1) ? "" : "s"));
3399 o_ptr->art_flags3 |= TR3_BLESSED;
3400 o_ptr->discount = 99;
3404 bool dis_happened = FALSE;
3407 msg_print("¤½¤ÎÉð´ï¤Ï½ËÊ¡¤ò·ù¤Ã¤Æ¤¤¤ë¡ª");
3409 msg_print("The weapon resists your blessing!");
3413 /* Disenchant tohit */
3414 if (o_ptr->to_h > 0)
3417 dis_happened = TRUE;
3420 if ((o_ptr->to_h > 5) && (randint0(100) < 33)) o_ptr->to_h--;
3422 /* Disenchant todam */
3423 if (o_ptr->to_d > 0)
3426 dis_happened = TRUE;
3429 if ((o_ptr->to_d > 5) && (randint0(100) < 33)) o_ptr->to_d--;
3431 /* Disenchant toac */
3432 if (o_ptr->to_a > 0)
3435 dis_happened = TRUE;
3438 if ((o_ptr->to_a > 5) && (randint0(100) < 33)) o_ptr->to_a--;
3443 msg_print("¼þ°Ï¤¬ËÞÍǤÊÊ·°Ïµ¤¤ÇËþ¤Á¤¿...");
3445 msg_print("There is a static feeling in the air...");
3449 msg_format("%s ¤ÏÎô²½¤·¤¿¡ª",
3452 msg_format("%s %s %s disenchanted!",
3453 ((item >= 0) ? "Your" : "The"), o_name,
3454 ((o_ptr->number > 1) ? "were" : "was"));
3460 /* Recalculate bonuses */
3461 p_ptr->update |= (PU_BONUS);
3464 p_ptr->window |= (PW_EQUIP | PW_PLAYER);
3475 bool pulish_shield(void)
3480 char o_name[MAX_NLEN];
3483 item_tester_no_ryoute = TRUE;
3484 /* Assume enchant weapon */
3485 item_tester_tval = TV_SHIELD;
3489 q = "¤É¤Î½â¤òËᤤޤ¹¤«¡©";
3490 s = "Ë᤯½â¤¬¤¢¤ê¤Þ¤»¤ó¡£";
3492 q = "Pulish which weapon? ";
3493 s = "You have weapon to pulish.";
3496 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR)))
3499 /* Get the item (in the pack) */
3502 o_ptr = &inventory[item];
3505 /* Get the item (on the floor) */
3508 o_ptr = &o_list[0 - item];
3513 object_desc(o_name, o_ptr, FALSE, 0);
3515 /* Extract the flags */
3516 object_flags(o_ptr, &f1, &f2, &f3);
3518 if (o_ptr->k_idx && !artifact_p(o_ptr) && !ego_item_p(o_ptr) &&
3519 !o_ptr->art_name && !cursed_p(o_ptr) && (o_ptr->sval != SV_SHIELD_OF_DEFLECTION))
3522 msg_format("%s¤Ïµ±¤¤¤¿¡ª", o_name);
3524 msg_format("%s %s shine%s!",
3525 ((item >= 0) ? "Your" : "The"), o_name,
3526 ((o_ptr->number > 1) ? "" : "s"));
3528 o_ptr->name2 = EGO_REFLECTION;
3529 enchant(o_ptr, randint0(3) + 4, ENCH_TOAC);
3531 o_ptr->discount = 99;
3532 chg_virtue(V_ENCHANT, 2);
3538 if (flush_failure) flush();
3541 msg_print("¼ºÇÔ¤·¤¿¡£");
3543 msg_print("Failed.");
3546 chg_virtue(V_ENCHANT, -2);
3555 * Potions "smash open" and cause an area effect when
3556 * (1) they are shattered while in the player's inventory,
3557 * due to cold (etc) attacks;
3558 * (2) they are thrown at a monster, or obstacle;
3559 * (3) they are shattered by a "cold ball" or other such spell
3560 * while lying on the floor.
3563 * who --- who caused the potion to shatter (0=player)
3564 * potions that smash on the floor are assumed to
3565 * be caused by no-one (who = 1), as are those that
3566 * shatter inside the player inventory.
3567 * (Not anymore -- I changed this; TY)
3568 * y, x --- coordinates of the potion (or player if
3569 * the potion was in her inventory);
3570 * o_ptr --- pointer to the potion object.
3572 bool potion_smash_effect(int who, int y, int x, int k_idx)
3580 object_kind *k_ptr = &k_info[k_idx];
3582 switch (k_ptr->sval)
3584 case SV_POTION_SALT_WATER:
3585 case SV_POTION_SLIME_MOLD:
3586 case SV_POTION_LOSE_MEMORIES:
3587 case SV_POTION_DEC_STR:
3588 case SV_POTION_DEC_INT:
3589 case SV_POTION_DEC_WIS:
3590 case SV_POTION_DEC_DEX:
3591 case SV_POTION_DEC_CON:
3592 case SV_POTION_DEC_CHR:
3593 case SV_POTION_WATER: /* perhaps a 'water' attack? */
3594 case SV_POTION_APPLE_JUICE:
3597 case SV_POTION_INFRAVISION:
3598 case SV_POTION_DETECT_INVIS:
3599 case SV_POTION_SLOW_POISON:
3600 case SV_POTION_CURE_POISON:
3601 case SV_POTION_BOLDNESS:
3602 case SV_POTION_RESIST_HEAT:
3603 case SV_POTION_RESIST_COLD:
3604 case SV_POTION_HEROISM:
3605 case SV_POTION_BESERK_STRENGTH:
3606 case SV_POTION_RES_STR:
3607 case SV_POTION_RES_INT:
3608 case SV_POTION_RES_WIS:
3609 case SV_POTION_RES_DEX:
3610 case SV_POTION_RES_CON:
3611 case SV_POTION_RES_CHR:
3612 case SV_POTION_INC_STR:
3613 case SV_POTION_INC_INT:
3614 case SV_POTION_INC_WIS:
3615 case SV_POTION_INC_DEX:
3616 case SV_POTION_INC_CON:
3617 case SV_POTION_INC_CHR:
3618 case SV_POTION_AUGMENTATION:
3619 case SV_POTION_ENLIGHTENMENT:
3620 case SV_POTION_STAR_ENLIGHTENMENT:
3621 case SV_POTION_SELF_KNOWLEDGE:
3622 case SV_POTION_EXPERIENCE:
3623 case SV_POTION_RESISTANCE:
3624 case SV_POTION_INVULNERABILITY:
3625 case SV_POTION_NEW_LIFE:
3626 /* All of the above potions have no effect when shattered */
3628 case SV_POTION_SLOWNESS:
3634 case SV_POTION_POISON:
3640 case SV_POTION_BLINDNESS:
3645 case SV_POTION_CONFUSION: /* Booze */
3650 case SV_POTION_SLEEP:
3655 case SV_POTION_RUINATION:
3656 case SV_POTION_DETONATIONS:
3658 dam = damroll(25, 25);
3662 case SV_POTION_DEATH:
3663 dt = GF_DEATH_RAY; /* !! */
3664 dam = k_ptr->level * 10;
3669 case SV_POTION_SPEED:
3673 case SV_POTION_CURE_LIGHT:
3675 dam = damroll(2, 3);
3678 case SV_POTION_CURE_SERIOUS:
3680 dam = damroll(4, 3);
3683 case SV_POTION_CURE_CRITICAL:
3684 case SV_POTION_CURING:
3686 dam = damroll(6, 3);
3689 case SV_POTION_HEALING:
3691 dam = damroll(10, 10);
3694 case SV_POTION_RESTORE_EXP:
3700 case SV_POTION_LIFE:
3702 dam = damroll(50, 50);
3706 case SV_POTION_STAR_HEALING:
3708 dam = damroll(50, 50);
3712 case SV_POTION_RESTORE_MANA: /* MANA */
3714 dam = damroll(10, 10);
3722 (void)project(who, radius, y, x, dam, dt,
3723 (PROJECT_JUMP | PROJECT_ITEM | PROJECT_KILL), -1);
3725 /* XXX those potions that explode need to become "known" */
3731 * Hack -- Display all known spells in a window
3733 * XXX XXX XXX Need to analyze size of the window.
3735 * XXX XXX XXX Need more color coding.
3737 void display_spell_list(void)
3741 int use_realm1 = p_ptr->realm1 - 1;
3742 int use_realm2 = p_ptr->realm2 - 1;
3752 /* Warriors are illiterate */
3753 if (!mp_ptr->spell_book) return;
3754 if (p_ptr->pclass == CLASS_SORCERER) return;
3755 if (p_ptr->pclass == CLASS_RED_MAGE) return;
3757 /* Mindcrafter spell-list */
3758 if ((p_ptr->pclass == CLASS_MINDCRAFTER) || (p_ptr->pclass == CLASS_FORCETRAINER))
3764 int plev = p_ptr->lev;
3771 /* Display a list of spells */
3774 put_str("̾Á°", y, x + 5);
3775 put_str("Lv MP ¼ºÎ¨ ¸ú²Ì", y, x + 35);
3777 put_str("Name", y, x + 5);
3778 put_str("Lv Mana Fail Info", y, x + 35);
3781 switch(p_ptr->pclass)
3783 case CLASS_MINDCRAFTER: use_mind = MIND_MINDCRAFTER;break;
3784 case CLASS_FORCETRAINER: use_mind = MIND_KI;break;
3785 default: use_mind = 0;break;
3788 /* Dump the spells */
3789 for (i = 0; i < MAX_MIND_POWERS; i++)
3791 byte a = TERM_WHITE;
3793 /* Access the available spell */
3794 spell = mind_powers[use_mind].info[i];
3795 if (spell.min_lev > plev) break;
3797 /* Get the failure rate */
3798 chance = spell.fail;
3800 /* Reduce failure rate by "effective" level adjustment */
3801 chance -= 3 * (p_ptr->lev - spell.min_lev);
3803 /* Reduce failure rate by INT/WIS adjustment */
3804 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
3806 /* Not enough mana to cast */
3807 if (spell.mana_cost > p_ptr->csp)
3809 chance += 5 * (spell.mana_cost - p_ptr->csp);
3813 /* Extract the minimum failure rate */
3814 minfail = adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]];
3816 /* Minimum failure rate */
3817 if (chance < minfail) chance = minfail;
3819 /* Stunning makes spells harder */
3820 if (p_ptr->stun > 50) chance += 25;
3821 else if (p_ptr->stun) chance += 15;
3823 /* Always a 5 percent chance of working */
3824 if (chance > 95) chance = 95;
3827 mindcraft_info(comment, use_mind, i);
3829 /* Dump the spell */
3830 sprintf(psi_desc, " %c) %-30s%2d %4d %3d%%%s",
3832 spell.min_lev, spell.mana_cost, chance, comment);
3834 Term_putstr(x, y + i + 1, -1, a, psi_desc);
3839 /* Normal spellcaster with books */
3842 for (j = 0; j < ((use_realm2 > -1) ? 2 : 1); j++)
3846 /* Reset vertical */
3849 /* Vertical location */
3850 y = (j < 3) ? 0 : (m[j - 3] + 2);
3852 /* Horizontal location */
3856 for (i = 0; i < 32; i++)
3858 byte a = TERM_WHITE;
3860 /* Access the spell */
3861 if (!is_magic((j < 1) ? use_realm1 : use_realm2))
3863 s_ptr = &technic_info[(j < 1) ? use_realm1 : use_realm2 - MIN_TECHNIC][i % 32];
3867 s_ptr = &mp_ptr->info[(j < 1) ? use_realm1 : use_realm2][i % 32];
3870 strcpy(name, spell_names[technic2magic((j < 1) ? use_realm1+1 : use_realm2+1)-1][i % 32]);
3873 if (s_ptr->slevel >= 99)
3877 strcpy(name, "(ȽÆÉÉÔǽ)");
3879 strcpy(name, "(illegible)");
3889 ((spell_forgotten1 & (1L << i))) :
3890 ((spell_forgotten2 & (1L << (i % 32)))))
3897 else if (!((j < 1) ?
3898 (spell_learned1 & (1L << i)) :
3899 (spell_learned2 & (1L << (i % 32)))))
3906 else if (!((j < 1) ?
3907 (spell_worked1 & (1L << i)) :
3908 (spell_worked2 & (1L << (i % 32)))))
3914 /* Dump the spell --(-- */
3915 sprintf(out_val, "%c/%c) %-20.20s",
3916 I2A(n / 8), I2A(n % 8), name);
3921 /* Dump onto the window */
3922 Term_putstr(x, m[j], -1, a, out_val);
3933 * Returns spell chance of failure for spell -RAK-
3935 s16b spell_chance(int spell, int realm)
3937 int chance, minfail;
3940 int penalty = (mp_ptr->spell_stat == A_WIS) ? 10 : 4;
3943 /* Paranoia -- must be literate */
3944 if (!mp_ptr->spell_book) return (100);
3946 if (realm+1 == REALM_HISSATSU) return 0;
3948 /* Access the spell */
3949 if (!is_magic(realm+1))
3951 s_ptr = &technic_info[realm - MIN_TECHNIC][spell];
3955 s_ptr = &mp_ptr->info[realm][spell];
3958 /* Extract the base spell failure rate */
3959 chance = s_ptr->sfail;
3961 /* Reduce failure rate by "effective" level adjustment */
3962 chance -= 3 * (p_ptr->lev - s_ptr->slevel);
3964 /* Reduce failure rate by INT/WIS adjustment */
3965 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
3968 chance += (MAX(r_info[m_list[p_ptr->riding].r_idx].level-skill_exp[GINOU_RIDING]/100-10,0));
3970 if (p_ptr->pclass == CLASS_SORCERER)
3971 shouhimana = s_ptr->smana*2200 + 2399;
3972 else if (p_ptr->pclass == CLASS_RED_MAGE)
3973 shouhimana = s_ptr->smana*2600 + 2399;
3974 else if ((realm+1 == p_ptr->realm1) || (realm+1 == p_ptr->realm2))
3975 shouhimana = (s_ptr->smana*(3800-spell_exp[((p_ptr->realm1 == realm+1) ? spell: spell+32)])+2399);
3976 else shouhimana = s_ptr->smana*3800;
3979 else shouhimana *= 4;
3981 if(shouhimana < 1) shouhimana = 1;
3983 /* Not enough mana to cast */
3984 if (shouhimana > p_ptr->csp)
3986 chance += 5 * (shouhimana - p_ptr->csp);
3989 if (p_ptr->pseikaku == SEIKAKU_NAMAKE) chance += 10;
3990 if (p_ptr->pseikaku == SEIKAKU_KIREMONO) chance -= 3;
3991 if ((p_ptr->pseikaku == SEIKAKU_GAMAN) || (p_ptr->pseikaku == SEIKAKU_CHIKARA)) chance++;
3992 if (((realm + 1) != p_ptr->realm1) && ((p_ptr->pclass == CLASS_MAGE) || (p_ptr->pclass == CLASS_PRIEST))) chance += 5;
3994 /* Extract the minimum failure rate */
3995 minfail = adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]];
3998 * Non mage/priest characters never get too good
3999 * (added high mage, mindcrafter)
4001 if (mp_ptr->spell_xtra & MAGIC_FAIL_5PERCENT)
4003 if (minfail < 5) minfail = 5;
4006 /* Hack -- Priest prayer penalty for "edged" weapons -DGK */
4007 if (((p_ptr->pclass == CLASS_PRIEST) || (p_ptr->pclass == CLASS_SORCERER)) && p_ptr->icky_wield[0]) chance += 25;
4008 if (((p_ptr->pclass == CLASS_PRIEST) || (p_ptr->pclass == CLASS_SORCERER)) && p_ptr->icky_wield[1]) chance += 25;
4010 if (p_ptr->heavy_spell) chance += 20;
4011 if(p_ptr->dec_mana && p_ptr->easy_spell) chance-=4;
4012 else if (p_ptr->easy_spell) chance-=3;
4013 else if (p_ptr->dec_mana) chance-=2;
4015 if ((realm+1 == REALM_NATURE) && ((p_ptr->align > 50) || (p_ptr->align < -50))) chance += penalty;
4016 if ((realm+1 == REALM_LIFE) && (p_ptr->align < -20)) chance += penalty;
4017 if (((realm+1 == REALM_DEATH) || (realm+1 == REALM_DAEMON)) && (p_ptr->align > 20)) chance += penalty;
4019 /* Minimum failure rate */
4020 if (chance < minfail) chance = minfail;
4022 /* Stunning makes spells harder */
4023 if (p_ptr->stun > 50) chance += 25;
4024 else if (p_ptr->stun) chance += 15;
4026 /* Always a 5 percent chance of working */
4027 if (chance > 95) chance = 95;
4029 if ((realm+1 == p_ptr->realm1) || (realm+1 == p_ptr->realm2))
4031 if(spell_exp[((p_ptr->realm1 == realm+1) ? spell: spell+32)]>1399) chance--;
4032 if(spell_exp[((p_ptr->realm1 == realm+1) ? spell: spell+32)]>1599) chance--;
4034 if(p_ptr->dec_mana) chance--;
4035 if (p_ptr->heavy_spell) chance += 5;
4037 chance = MAX(chance,0);
4039 /* Return the chance */
4046 * Determine if a spell is "okay" for the player to cast or study
4047 * The spell must be legible, not forgotten, and also, to cast,
4048 * it must be known, and to study, it must not be known.
4050 bool spell_okay(int spell, bool learned, bool study_pray, int realm)
4054 /* Access the spell */
4055 if (!is_magic(realm+1))
4057 s_ptr = &technic_info[realm - MIN_TECHNIC][spell];
4061 s_ptr = &mp_ptr->info[realm][spell];
4064 /* Spell is illegal */
4065 if (s_ptr->slevel > p_ptr->lev) return (FALSE);
4067 /* Spell is forgotten */
4068 if ((realm == p_ptr->realm2 - 1) ?
4069 (spell_forgotten2 & (1L << spell)) :
4070 (spell_forgotten1 & (1L << spell)))
4076 if (p_ptr->pclass == CLASS_SORCERER) return (TRUE);
4077 if (p_ptr->pclass == CLASS_RED_MAGE) return (TRUE);
4079 /* Spell is learned */
4080 if ((realm == p_ptr->realm2 - 1) ?
4081 (spell_learned2 & (1L << spell)) :
4082 (spell_learned1 & (1L << spell)))
4085 return (!study_pray);
4088 /* Okay to study, not to cast */
4095 * Extra information on a spell -DRS-
4097 * We can use up to 14 characters of the buffer 'p'
4099 * The strings in this function were extracted from the code in the
4100 * functions "do_cmd_cast()" and "do_cmd_pray()" and may be dated.
4102 static void spell_info(char *p, int spell, int realm)
4104 int plev = p_ptr->lev;
4107 int orb = plev + (plev / ((p_ptr->pclass == CLASS_PRIEST ||
4108 p_ptr->pclass == CLASS_HIGH_MAGE ||
4109 p_ptr->pclass == CLASS_SORCERER) ? 2 : 4));
4111 int burst = plev + (plev / ((p_ptr->pclass == CLASS_MAGE ||
4112 p_ptr->pclass == CLASS_HIGH_MAGE ||
4113 p_ptr->pclass == CLASS_SORCERER) ? 2 : 4));
4115 cptr s_dam = "»½ý:";
4116 cptr s_dur = "´ü´Ö:";
4117 cptr s_range = "ÈÏ°Ï:";
4118 cptr s_heal = "²óÉü:";
4119 cptr s_random = "¥é¥ó¥À¥à";
4120 cptr s_delay = "ÃÙ±ä:";
4122 cptr s_dam = "dam ";
4123 cptr s_dur = "dur ";
4124 cptr s_range = "range ";
4125 cptr s_heal = "heal ";
4126 cptr s_random = "random";
4127 cptr s_delay = "delay ";
4132 /* Analyze the spell */
4138 case 1: sprintf(p, " %s2d10", s_heal); break;
4139 case 2: sprintf(p, " %s12+d12", s_dur); break;
4140 case 4: sprintf(p, " %s%d", s_dam, 10 + (plev / 2)); break;
4141 case 6: sprintf(p, " %s4d10", s_heal); break;
4142 case 10: sprintf(p, " %s8d10", s_heal); break;
4143 case 11: sprintf(p, " %s24+d24", s_dur); break;
4144 case 12: sprintf(p, " %s3d6+%d", s_dam, orb); break;
4145 case 13: sprintf(p, " %sd25+%d", s_dur, 3 * plev); break;
4146 case 14: sprintf(p, " %s300", s_heal); break;
4147 case 16: sprintf(p, " %sd%d", s_dam, plev); break;
4148 case 18: sprintf(p, " %sd%d", s_dam, 3 * plev); break;
4149 case 20: sprintf(p, " %sd%d", s_dam, 4 * plev); break;
4151 case 22: sprintf(p, " »:d%d/²ó:1000", 4 * plev); break;
4153 case 22: sprintf(p, " d %d/h 1000", 4 * plev); break;
4155 case 24: sprintf(p, " %s25+d25", s_dur); break;
4156 case 25: sprintf(p, " %s48+d48", s_dur); break;
4157 case 28: sprintf(p, " %s2000", s_heal); break;
4159 case 30: sprintf(p, " ²ó300/»%d+250", plev * 4); break;
4161 case 30: sprintf(p, " h300/d%d+250", plev * 4); break;
4163 case 31: sprintf(p, " %s%d+d%d", s_dur,(plev/2), (plev/2)); break;
4167 case 1: /* Sorcery */
4170 case 1: sprintf(p, " %s10", s_range); break;
4171 case 3: sprintf(p, " %s%d", s_dam, 10 + (plev / 2)); break;
4172 case 5: sprintf(p, " %s%d", s_range, plev * 5); break;
4173 case 13: sprintf(p, " %s%d+d%d", s_dur, plev, plev + 20); break;
4174 case 18: sprintf(p, " %s25+d30", s_dur); break;
4175 case 22: sprintf(p, " %s15+d21", s_delay); break;
4176 case 23: sprintf(p, " %s%d", s_range, plev / 2 + 10); break;
4177 case 25: sprintf(p, " %s7d7+%d", s_dam, plev); break;
4179 case 26: sprintf(p, " ºÇÂç½ÅÎÌ:%d.%dkg", lbtokg1(plev * 15),lbtokg2(plev * 15)); break;
4181 case 26: sprintf(p, " max wgt %d", plev * 15 / 10); break;
4183 case 27: sprintf(p, " %s25+d30", s_dur); break;
4184 case 31: sprintf(p, " %s4+d4", s_dur); break;
4188 case 2: /* Nature */
4192 case 1: sprintf(p, " %s%dd4 ¼ÍÄø%d", s_dam, (3 + ((plev - 1) / 5)), plev/6+2); break;
4194 case 1: sprintf(p, " %s%dd4 rng %d", s_dam, (3 + ((plev - 1) / 5)), plev/6+2); break;
4196 case 4: sprintf(p, " %s%d", s_dam, 10 + (plev / 2)); break;
4197 case 6: sprintf(p, " %s20+d20", s_dur); break;
4198 case 7: sprintf(p, " %s2d8", s_heal); break;
4199 case 9: sprintf(p, " %s%dd8", s_dam, (3 + ((plev - 5) / 4))); break;
4200 case 11: sprintf(p, " %s%dd8", s_dam, (5 + ((plev - 5) / 4))); break;
4201 case 12: sprintf(p, " %s6d8", s_dam); break;
4202 case 15: sprintf(p, " %s500", s_heal); break;
4203 case 17: sprintf(p, " %s20+d30", s_dur); break;
4204 case 18: sprintf(p, " %s20+d20", s_dur); break;
4206 case 24: sprintf(p, " Ⱦ·Â:10"); break;
4208 case 24: sprintf(p, " rad 10"); break;
4210 case 26: sprintf(p, " %s%d", s_dam, 70 + plev * 3 / 2); break;
4211 case 27: sprintf(p, " %s%d", s_dam, 90 + plev * 3 / 2); break;
4212 case 28: sprintf(p, " %s%d", s_dam, 100 + plev * 3 / 2); break;
4213 case 29: sprintf(p, " %s75", s_dam); break;
4214 case 31: sprintf(p, " %s%d+%d", s_dam, 4 * plev, 100 + plev); break;
4221 case 0: sprintf(p, " %s%dd4", s_dam, 3 + ((plev - 1) / 5)); break;
4222 case 2: sprintf(p, " %s%d", s_dam, 10 + (plev / 2)); break;
4223 case 4: sprintf(p, " %s3d5+%d", s_dam, burst); break;
4224 case 5: sprintf(p, " %s%dd8", s_dam, (6 + ((plev - 5) / 4))); break;
4225 case 6: sprintf(p, " %s%dd8", s_dam, (8 + ((plev - 5) / 4))); break;
4226 case 7: sprintf(p, " %s%d", s_range, plev * 5); break;
4227 case 8: sprintf(p, " %s", s_random); break;
4228 case 9: sprintf(p, " %s%dd8", s_dam, (10 + ((plev - 5) / 4))); break;
4229 case 10: sprintf(p, " %s%d", s_dam, (60 + plev)/2); break;
4230 case 11: sprintf(p, " %s%dd8", s_dam, (11 + ((plev - 5) / 4))); break;
4231 case 12: sprintf(p, " %s%d", s_dam, 55 + plev); break;
4232 case 15: sprintf(p, " %s%d", s_dam, 99 + plev*2); break;
4233 case 17: sprintf(p, " %s%dd8", s_dam, (5 + (plev / 10))); break;
4234 case 19: sprintf(p, " %s%d", s_dam, 70 + plev); break;
4235 case 21: sprintf(p, " %s%d", s_dam, 120 + plev*2); break;
4236 case 24: sprintf(p, " %s%dd8", s_dam, (9 + (plev / 10))); break;
4238 case 25: sprintf(p, " %s³Æ%d", s_dam, plev * 2); break;
4240 case 25: sprintf(p, " dam %d each", plev * 2); break;
4242 case 26: sprintf(p, " %s%d", s_dam, 150 + plev*3/2); break;
4243 case 27: sprintf(p, " %s150 / 250", s_dam); break;
4244 case 29: sprintf(p, " %s%d", s_dam, 300 + (plev * 4)); break;
4245 case 30: sprintf(p, " %s%d", s_dam, p_ptr->chp); break;
4246 case 31: sprintf(p, " %s3 * 175", s_dam); break;
4253 case 1: sprintf(p, " %s%dd3", s_dam, (3 + ((plev - 1) / 5))); break;
4254 case 3: sprintf(p, " %s%d", s_dam, 10 + (plev / 2)); break;
4255 case 5: sprintf(p, " %s20+d20", s_dur); break;
4256 case 8: sprintf(p, " %s3d6+%d", s_dam, burst); break;
4257 case 9: sprintf(p, " %s%dd8", s_dam, (8 + ((plev - 5) / 4))); break;
4258 case 10: sprintf(p, " %s%d", s_dam, 30+plev); break;
4260 case 13: sprintf(p, " »:%d+d%d", plev * 2, plev * 2); break;
4262 case 13: sprintf(p, " d %d+d%d", plev * 2, plev * 2); break;
4264 case 16: sprintf(p, " %s25+d25", s_dur); break;
4265 case 17: sprintf(p, " %s", s_random); break;
4266 case 18: sprintf(p, " %s%dd8", s_dam, (4 + ((plev - 5) / 4))); break;
4267 case 19: sprintf(p, " %s25+d25", s_dur); break;
4268 case 21: sprintf(p, " %s3*100", s_dam); break;
4269 case 22: sprintf(p, " %sd%d", s_dam, plev * 3); break;
4270 case 23: sprintf(p, " %s%d", s_dam, 100 + plev * 2); break;
4271 case 27: sprintf(p, " %s%d+d%d", s_dur,10+plev/2, 10+plev/2); break;
4272 case 30: sprintf(p, " %s666", s_dam); break;
4273 case 31: sprintf(p, " %s%d+d%d", s_dur, (plev / 2), (plev / 2)); break;
4280 case 0: sprintf(p, " %s10", s_range); break;
4281 case 2: sprintf(p, " %s", s_random); break;
4282 case 4: sprintf(p, " %s%d", s_range, plev * 4); break;
4283 case 5: sprintf(p, " %s25+d30", s_dur); break;
4285 case 8: sprintf(p, " ºÇÂç½ÅÎÌ:%d.%d", lbtokg1(plev * 15 / 10),lbtokg2(plev * 15 / 10)); break;
4287 case 8: sprintf(p, " max wgt %d", plev * 15 / 10); break;
4289 case 13: sprintf(p, " %s%d", s_range, plev / 2 + 10); break;
4290 case 14: sprintf(p, " %s15+d21", s_delay); break;
4291 case 26: sprintf(p, " %s%d", s_heal, plev * 10 + 200); break;
4293 case 28: sprintf(p, " %s³Æ%d", s_dam, plev * 2); break;
4295 case 28: sprintf(p, " dam %d each", plev * 2); break;
4300 case 6: /* Arcane */
4303 case 0: sprintf(p, " %s%dd3", s_dam, 3 + ((plev - 1) / 5)); break;
4304 case 4: sprintf(p, " %s10", s_range); break;
4305 case 5: sprintf(p, " %s2d%d", s_dam, plev / 2); break;
4306 case 7: sprintf(p, " %s2d8", s_heal); break;
4310 case 17: sprintf(p, " %s20+d20", s_dur); break;
4311 case 18: sprintf(p, " %s4d8", s_heal); break;
4312 case 19: sprintf(p, " %s%d", s_range, plev * 5); break;
4313 case 21: sprintf(p, " %s6d8", s_dam); break;
4314 case 24: sprintf(p, " %s24+d24", s_dur); break;
4315 case 28: sprintf(p, " %s%d", s_dam, 75 + plev); break;
4316 case 30: sprintf(p, " %s15+d21", s_delay); break;
4317 case 31: sprintf(p, " %s25+d30", s_dur); break;
4324 case 0: sprintf(p, " %s100+d100", s_dur); break;
4325 case 1: sprintf(p, " %s80+d80", s_dur); break;
4331 case 18: sprintf(p, " %s20+d20", s_dur); break;
4332 case 5: sprintf(p, " %s25+d25", s_dur); break;
4333 case 8: sprintf(p, " %s24+d24", s_dur); break;
4334 case 11: sprintf(p, " %s25+d25", s_dur); break;
4335 case 13: sprintf(p, " %s%d+d25", s_dur, plev * 3); break;
4336 case 15: sprintf(p, " %s%d+d%d", s_dur, plev/2, plev/2); break;
4337 case 16: sprintf(p, " %s25+d30", s_dur); break;
4338 case 17: sprintf(p, " %s30+d20", s_dur); break;
4339 case 19: sprintf(p, " %s%d+d%d", s_dur, plev+20, plev); break;
4340 case 20: sprintf(p, " %s50+d50", s_dur); break;
4341 case 23: sprintf(p, " %s20+d20", s_dur); break;
4342 case 31: sprintf(p, " %s13+d13", s_dur); break;
4346 case 8: /* Daemon */
4349 case 0: sprintf(p, " %s%dd4", s_dam, 3 + ((plev - 1) / 5)); break;
4350 case 2: sprintf(p, " %s12+d12", s_dur); break;
4351 case 3: sprintf(p, " %s20+d20", s_dur); break;
4352 case 5: sprintf(p, " %s%dd8", s_dam, (6 + ((plev - 5) / 4))); break;
4353 case 7: sprintf(p, " %s3d6+%d", s_dam, burst); break;
4354 case 10: sprintf(p, " %s20+d20", s_dur); break;
4355 case 11: sprintf(p, " %s%dd8", s_dam, (11 + ((plev - 5) / 4))); break;
4356 case 12: sprintf(p, " %s%d", s_dam, 55 + plev); break;
4357 case 14: sprintf(p, " %s%d", s_dam, 100 + plev*3/2); break;
4358 case 16: sprintf(p, " %s30+d25", s_dur); break;
4359 case 17: sprintf(p, " %s20+d20", s_dur); break;
4360 case 18: sprintf(p, " %s%d", s_dam, 55 + plev); break;
4361 case 19: sprintf(p, " %s%d", s_dam, 80 + plev*3/2); break;
4362 case 20: sprintf(p, " %s%d+d%d", s_dur,10+plev/2, 10+plev/2); break;
4363 case 21: sprintf(p, " %sd%d+d%d", s_dam, 2 * plev, 2 * plev); break;
4364 case 22: sprintf(p, " %s%d", s_dam, 100 + plev*2); break;
4365 case 24: sprintf(p, " %s25+d25", s_dur); break;
4366 case 25: sprintf(p, " %s20+d20", s_dur); break;
4367 case 26: sprintf(p, " %s%d+%d", s_dam, 25+plev/2, 25+plev/2); break;
4368 case 29: sprintf(p, " %s%d", s_dam, plev*15); break;
4369 case 30: sprintf(p, " %s600", s_dam); break;
4370 case 31: sprintf(p, " %s15+d15", s_dur); break;
4374 case 15: /* Music */
4377 case 2 : sprintf(p, " %s%dd4", s_dam, 4 + ((plev - 1) / 5)); break;
4378 case 4 : sprintf(p, " %s2d6", s_heal); break;
4379 case 9 : sprintf(p, " %sd%d", s_dam, plev * 3 / 2); break;
4380 case 13: sprintf(p, " %s%dd7", s_dam, 10 + (plev / 5)); break;
4381 case 20: sprintf(p, " %sd%d+d%d", s_dam, plev * 3, plev * 3); break;
4382 case 22: sprintf(p, " %s%dd10", s_dam, 15 + ((plev - 1) / 2)); break;
4383 case 27: sprintf(p, " %sd%d", s_dam, plev * 3); break;
4384 case 28: sprintf(p, " %s15d10", s_heal); break;
4385 case 30: sprintf(p, " %s%dd10", s_dam, 50 + plev); break;
4390 sprintf(p, "̤ÃΤΥ¿¥¤¥×: %d", realm);
4392 sprintf(p, "Unknown type: %d.", realm);
4399 * Print a list of spells (for browsing or casting or viewing)
4401 void print_spells(int target_spell, byte *spells, int num, int y, int x, int realm)
4403 int i, spell, shougou, increment = 64;
4415 if (((realm < 0) || (realm > MAX_REALM - 1)) && wizard)
4417 msg_print("·Ù¹ð¡ª print_spell ¤¬Îΰè¤Ê¤·¤Ë¸Æ¤Ð¤ì¤¿");
4419 msg_print("Warning! print_spells called with null realm");
4423 /* Title the list */
4425 if (realm+1 == REALM_HISSATSU)
4427 strcpy(buf," Lv MP");
4429 strcpy(buf," Lv SP");
4433 strcpy(buf,"½ÏÎýÅÙ Lv MP ¼ºÎ¨ ¸ú²Ì");
4435 strcpy(buf,"Profic Lv SP Fail Effect");
4439 put_str("̾Á°", y, x + 5);
4440 put_str(buf, y, x + 29);
4442 put_str("Name", y, x + 5);
4443 put_str(buf, y, x + 29);
4446 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE)) increment = 0;
4447 else if ((realm + 1) == p_ptr->realm1) increment = 0;
4448 else if ((realm + 1) == p_ptr->realm2) increment = 32;
4450 /* Dump the spells */
4451 for (i = 0; i < num; i++)
4453 /* Access the spell */
4456 /* Access the spell */
4457 if (!is_magic(realm+1))
4459 s_ptr = &technic_info[realm - MIN_TECHNIC][spell];
4463 s_ptr = &mp_ptr->info[realm][spell];
4466 if (realm+1 == REALM_HISSATSU)
4467 shouhimana = s_ptr->smana;
4470 if (p_ptr->pclass == CLASS_SORCERER)
4471 shouhimana = s_ptr->smana*2200 + 2399;
4472 else if (p_ptr->pclass == CLASS_RED_MAGE)
4473 shouhimana = s_ptr->smana*2600 + 2399;
4474 else if ((realm+1 == p_ptr->realm1) || (realm+1 == p_ptr->realm2))
4475 shouhimana = (s_ptr->smana*(3800-spell_exp[(spell+increment)])+2399);
4477 shouhimana = s_ptr->smana*3800+2399;
4480 else shouhimana *= 4;
4482 if(shouhimana < 1) shouhimana = 1;
4485 if ((increment == 64) || (s_ptr->slevel >= 99)) shougou = 0;
4486 else if (spell_exp[spell+increment]<900) shougou = 0;
4487 else if (spell_exp[spell+increment]<1200) shougou = 1;
4488 else if (spell_exp[spell+increment]<1400) shougou = 2;
4489 else if (spell_exp[spell+increment]<1600) shougou = 3;
4492 if (!increment && (shougou == 4)) max = TRUE;
4493 else if ((increment == 32) && (shougou == 3)) max = TRUE;
4494 else if (s_ptr->slevel >= 99) max = TRUE;
4495 else if (p_ptr->pclass == CLASS_RED_MAGE) max = TRUE;
4497 strncpy(ryakuji,shougou_moji[shougou],4);
4501 if (use_menu && target_spell)
4503 if (i == (target_spell-1))
4505 strcpy(out_val, " ¡Õ ");
4507 strcpy(out_val, " > ");
4510 strcpy(out_val, " ");
4512 else sprintf(out_val, " %c) ", I2A(i));
4513 /* Skip illegible spells */
4514 if (s_ptr->slevel >= 99)
4517 strcat(out_val, format("%-30s", "(ȽÆÉÉÔǽ)"));
4519 strcat(out_val, format("%-30s", "(illegible)"));
4522 c_prt(TERM_L_DARK, out_val, y + i + 1, x);
4526 /* XXX XXX Could label spells above the players level */
4528 /* Get extra info */
4529 spell_info(info, spell, realm);
4534 /* Assume spell is known and tried */
4535 line_attr = TERM_WHITE;
4537 /* Analyze the spell */
4538 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4540 if (s_ptr->slevel > p_ptr->max_plv)
4545 comment = " unknown";
4548 line_attr = TERM_L_BLUE;
4550 else if (s_ptr->slevel > p_ptr->lev)
4555 comment = " forgotten";
4558 line_attr = TERM_YELLOW;
4561 else if ((realm+1 != p_ptr->realm1) && (realm+1 != p_ptr->realm2))
4566 comment = " unknown";
4569 line_attr = TERM_L_BLUE;
4571 else if ((realm + 1 == p_ptr->realm1) ?
4572 ((spell_forgotten1 & (1L << spell))) :
4573 ((spell_forgotten2 & (1L << spell))))
4578 comment = " forgotten";
4581 line_attr = TERM_YELLOW;
4583 else if (!((realm + 1 == p_ptr->realm1) ?
4584 (spell_learned1 & (1L << spell)) :
4585 (spell_learned2 & (1L << spell))))
4590 comment = " unknown";
4593 line_attr = TERM_L_BLUE;
4595 else if (!((realm + 1 == p_ptr->realm1) ?
4596 (spell_worked1 & (1L << spell)) :
4597 (spell_worked2 & (1L << spell))))
4600 comment = " ̤·Ð¸³";
4602 comment = " untried";
4605 line_attr = TERM_L_GREEN;
4608 /* Dump the spell --(-- */
4609 if (realm+1 == REALM_HISSATSU)
4611 strcat(out_val, format("%-25s %2d %4d",
4612 spell_names[technic2magic(realm+1)-1][spell], /* realm, spell */
4613 s_ptr->slevel, shouhimana));
4617 strcat(out_val, format("%-25s%c%-4s %2d %4d %3d%%%s",
4618 spell_names[technic2magic(realm+1)-1][spell], /* realm, spell */
4619 (max ? '!' : ' '), ryakuji,
4620 s_ptr->slevel, shouhimana, spell_chance(spell, realm), comment));
4622 c_prt(line_attr, out_val, y + i + 1, x);
4625 /* Clear the bottom line */
4626 prt("", y + i + 1, x);
4631 * Note that amulets, rods, and high-level spell books are immune
4632 * to "inventory damage" of any kind. Also sling ammo and shovels.
4637 * Does a given class of objects (usually) hate acid?
4638 * Note that acid can either melt or corrode something.
4640 bool hates_acid(object_type *o_ptr)
4642 /* Analyze the type */
4643 switch (o_ptr->tval)
4645 /* Wearable items */
4665 /* Staffs/Scrolls are wood/paper */
4678 /* Junk is useless */
4692 * Does a given object (usually) hate electricity?
4694 bool hates_elec(object_type *o_ptr)
4696 switch (o_ptr->tval)
4710 * Does a given object (usually) hate fire?
4711 * Hafted/Polearm weapons have wooden shafts.
4712 * Arrows/Bows are mostly wooden.
4714 bool hates_fire(object_type *o_ptr)
4716 /* Analyze the type */
4717 switch (o_ptr->tval)
4735 case TV_SORCERY_BOOK:
4736 case TV_NATURE_BOOK:
4740 case TV_ARCANE_BOOK:
4741 case TV_ENCHANT_BOOK:
4742 case TV_DAEMON_BOOK:
4744 case TV_HISSATSU_BOOK:
4755 /* Staffs/Scrolls burn */
4768 * Does a given object (usually) hate cold?
4770 bool hates_cold(object_type *o_ptr)
4772 switch (o_ptr->tval)
4789 int set_acid_destroy(object_type *o_ptr)
4792 if (!hates_acid(o_ptr)) return (FALSE);
4793 object_flags(o_ptr, &f1, &f2, &f3);
4794 if (f3 & TR3_IGNORE_ACID) return (FALSE);
4802 int set_elec_destroy(object_type *o_ptr)
4805 if (!hates_elec(o_ptr)) return (FALSE);
4806 object_flags(o_ptr, &f1, &f2, &f3);
4807 if (f3 & TR3_IGNORE_ELEC) return (FALSE);
4815 int set_fire_destroy(object_type *o_ptr)
4818 if (!hates_fire(o_ptr)) return (FALSE);
4819 object_flags(o_ptr, &f1, &f2, &f3);
4820 if (f3 & TR3_IGNORE_FIRE) return (FALSE);
4828 int set_cold_destroy(object_type *o_ptr)
4831 if (!hates_cold(o_ptr)) return (FALSE);
4832 object_flags(o_ptr, &f1, &f2, &f3);
4833 if (f3 & TR3_IGNORE_COLD) return (FALSE);
4839 * Destroys a type of item on a given percent chance
4840 * Note that missiles are no longer necessarily all destroyed
4841 * Destruction taken from "melee.c" code for "stealing".
4842 * New-style wands and rods handled correctly. -LM-
4843 * Returns number of items destroyed.
4845 int inven_damage(inven_func typ, int perc)
4849 char o_name[MAX_NLEN];
4851 /* Multishadow effects is determined by turn */
4852 if( p_ptr->multishadow && (turn & 1) )return 0;
4854 if (p_ptr->inside_arena) return 0;
4856 /* Count the casualties */
4859 /* Scan through the slots backwards */
4860 for (i = 0; i < INVEN_PACK; i++)
4862 o_ptr = &inventory[i];
4864 /* Skip non-objects */
4865 if (!o_ptr->k_idx) continue;
4867 /* Hack -- for now, skip artifacts */
4868 if (artifact_p(o_ptr) || o_ptr->art_name) continue;
4870 /* Give this item slot a shot at death */
4873 /* Count the casualties */
4874 for (amt = j = 0; j < o_ptr->number; ++j)
4876 if (randint0(100) < perc) amt++;
4879 /* Some casualities */
4882 /* Get a description */
4883 object_desc(o_name, o_ptr, FALSE, 3);
4887 msg_format("%s(%c)¤¬%s²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª",
4889 msg_format("%sour %s (%c) %s destroyed!",
4893 o_name, index_to_label(i),
4894 ((o_ptr->number > 1) ?
4895 ((amt == o_ptr->number) ? "Á´Éô" :
4896 (amt > 1 ? "²¿¸Ä¤«" : "°ì¸Ä")) : "") );
4898 ((o_ptr->number > 1) ?
4899 ((amt == o_ptr->number) ? "All of y" :
4900 (amt > 1 ? "Some of y" : "One of y")) : "Y"),
4901 o_name, index_to_label(i),
4902 ((amt > 1) ? "were" : "was"));
4906 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
4907 msg_print("¤ä¤ê¤ä¤¬¤Ã¤¿¤Ê¡ª");
4910 /* Potions smash open */
4911 if (object_is_potion(o_ptr))
4913 (void)potion_smash_effect(0, py, px, o_ptr->k_idx);
4916 /* Reduce the charges of rods/wands */
4917 reduce_charges(o_ptr, amt);
4919 /* Destroy "amt" items */
4920 inven_item_increase(i, -amt);
4921 inven_item_optimize(i);
4923 /* Count the casualties */
4929 /* Return the casualty count */
4935 * Acid has hit the player, attempt to affect some armor.
4937 * Note that the "base armor" of an object never changes.
4939 * If any armor is damaged (or resists), the player takes less damage.
4941 static int minus_ac(void)
4943 object_type *o_ptr = NULL;
4945 char o_name[MAX_NLEN];
4948 /* Pick a (possibly empty) inventory slot */
4949 switch (randint1(7))
4951 case 1: o_ptr = &inventory[INVEN_RARM]; break;
4952 case 2: o_ptr = &inventory[INVEN_LARM]; break;
4953 case 3: o_ptr = &inventory[INVEN_BODY]; break;
4954 case 4: o_ptr = &inventory[INVEN_OUTER]; break;
4955 case 5: o_ptr = &inventory[INVEN_HANDS]; break;
4956 case 6: o_ptr = &inventory[INVEN_HEAD]; break;
4957 case 7: o_ptr = &inventory[INVEN_FEET]; break;
4960 /* Nothing to damage */
4961 if (!o_ptr->k_idx) return (FALSE);
4963 if (o_ptr->tval < TV_BOOTS) return (FALSE);
4965 /* No damage left to be done */
4966 if (o_ptr->ac + o_ptr->to_a <= 0) return (FALSE);
4970 object_desc(o_name, o_ptr, FALSE, 0);
4972 /* Extract the flags */
4973 object_flags(o_ptr, &f1, &f2, &f3);
4975 /* Object resists */
4976 if (f3 & TR3_IGNORE_ACID)
4979 msg_format("¤·¤«¤·%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª", o_name);
4981 msg_format("Your %s is unaffected!", o_name);
4990 msg_format("%s¤¬¥À¥á¡¼¥¸¤ò¼õ¤±¤¿¡ª", o_name);
4992 msg_format("Your %s is damaged!", o_name);
4996 /* Damage the item */
4999 /* Calculate bonuses */
5000 p_ptr->update |= (PU_BONUS);
5003 p_ptr->window |= (PW_EQUIP | PW_PLAYER);
5007 /* Item was damaged */
5013 * Hurt the player with Acid
5015 void acid_dam(int dam, cptr kb_str, int monspell)
5017 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
5018 bool double_resist = (p_ptr->oppose_acid || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
5020 /* Total Immunity */
5021 if (p_ptr->immune_acid || (dam <= 0))
5023 learn_spell(monspell);
5027 /* Vulnerability (Ouch!) */
5028 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
5029 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
5031 /* Resist the damage */
5032 if (p_ptr->resist_acid) dam = (dam + 2) / 3;
5033 if (double_resist) dam = (dam + 2) / 3;
5035 if ((!(double_resist || p_ptr->resist_acid)) &&
5036 one_in_(HURT_CHANCE))
5037 (void)do_dec_stat(A_CHR);
5039 /* If any armor gets hit, defend the player */
5040 if (minus_ac()) dam = (dam + 1) / 2;
5043 take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
5045 /* Inventory damage */
5046 if (!(double_resist && p_ptr->resist_acid))
5047 inven_damage(set_acid_destroy, inv);
5052 * Hurt the player with electricity
5054 void elec_dam(int dam, cptr kb_str, int monspell)
5056 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
5057 bool double_resist = (p_ptr->oppose_elec || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
5059 /* Total immunity */
5060 if (p_ptr->immune_elec || (dam <= 0))
5062 learn_spell(monspell);
5066 /* Vulnerability (Ouch!) */
5067 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
5068 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
5069 if (p_ptr->prace == RACE_ANDROID) dam += dam / 3;
5071 /* Resist the damage */
5072 if (p_ptr->resist_elec) dam = (dam + 2) / 3;
5073 if (double_resist) dam = (dam + 2) / 3;
5075 if ((!(double_resist || p_ptr->resist_elec)) &&
5076 one_in_(HURT_CHANCE))
5077 (void)do_dec_stat(A_DEX);
5080 take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
5082 /* Inventory damage */
5083 if (!(double_resist && p_ptr->resist_elec))
5084 inven_damage(set_elec_destroy, inv);
5089 * Hurt the player with Fire
5091 void fire_dam(int dam, cptr kb_str, int monspell)
5093 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
5094 bool double_resist = (p_ptr->oppose_fire || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
5096 /* Totally immune */
5097 if (p_ptr->immune_fire || (dam <= 0))
5099 learn_spell(monspell);
5103 /* Vulnerability (Ouch!) */
5104 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
5105 if (prace_is_(RACE_ENT)) dam += dam / 3;
5106 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
5108 /* Resist the damage */
5109 if (p_ptr->resist_fire) dam = (dam + 2) / 3;
5110 if (double_resist) dam = (dam + 2) / 3;
5112 if ((!(double_resist || p_ptr->resist_fire)) &&
5113 one_in_(HURT_CHANCE))
5114 (void)do_dec_stat(A_STR);
5117 take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
5119 /* Inventory damage */
5120 if (!(double_resist && p_ptr->resist_fire))
5121 inven_damage(set_fire_destroy, inv);
5126 * Hurt the player with Cold
5128 void cold_dam(int dam, cptr kb_str, int monspell)
5130 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
5131 bool double_resist = (p_ptr->oppose_cold || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
5133 /* Total immunity */
5134 if (p_ptr->immune_cold || (dam <= 0))
5136 learn_spell(monspell);
5140 /* Vulnerability (Ouch!) */
5141 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
5142 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
5144 /* Resist the damage */
5145 if (p_ptr->resist_cold) dam = (dam + 2) / 3;
5146 if (double_resist) dam = (dam + 2) / 3;
5148 if ((!(double_resist || p_ptr->resist_cold)) &&
5149 one_in_(HURT_CHANCE))
5150 (void)do_dec_stat(A_STR);
5153 take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
5155 /* Inventory damage */
5156 if (!(double_resist && p_ptr->resist_cold))
5157 inven_damage(set_cold_destroy, inv);
5161 bool rustproof(void)
5165 char o_name[MAX_NLEN];
5168 item_tester_no_ryoute = TRUE;
5169 /* Select a piece of armour */
5170 item_tester_hook = item_tester_hook_armour;
5174 q = "¤É¤ÎËɶñ¤Ë»¬»ß¤á¤ò¤·¤Þ¤¹¤«¡©";
5175 s = "»¬»ß¤á¤Ç¤¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
5177 q = "Rustproof which piece of armour? ";
5178 s = "You have nothing to rustproof.";
5181 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return FALSE;
5183 /* Get the item (in the pack) */
5186 o_ptr = &inventory[item];
5189 /* Get the item (on the floor) */
5192 o_ptr = &o_list[0 - item];
5197 object_desc(o_name, o_ptr, FALSE, 0);
5199 o_ptr->art_flags3 |= TR3_IGNORE_ACID;
5201 if ((o_ptr->to_a < 0) && !(o_ptr->ident & IDENT_CURSED))
5204 msg_format("%s¤Ï¿·ÉÊƱÍͤˤʤä¿¡ª",o_name);
5206 msg_format("%s %s look%s as good as new!",
5207 ((item >= 0) ? "Your" : "The"), o_name,
5208 ((o_ptr->number > 1) ? "" : "s"));
5215 msg_format("%s¤ÏÉå¿©¤·¤Ê¤¯¤Ê¤Ã¤¿¡£", o_name);
5217 msg_format("%s %s %s now protected against corrosion.",
5218 ((item >= 0) ? "Your" : "The"), o_name,
5219 ((o_ptr->number > 1) ? "are" : "is"));
5230 * Curse the players armor
5232 bool curse_armor(void)
5236 char o_name[MAX_NLEN];
5239 /* Curse the body armor */
5240 o_ptr = &inventory[INVEN_BODY];
5242 /* Nothing to curse */
5243 if (!o_ptr->k_idx) return (FALSE);
5247 object_desc(o_name, o_ptr, FALSE, 3);
5249 /* Attempt a saving throw for artifacts */
5250 if ((o_ptr->art_name || artifact_p(o_ptr)) && (randint0(100) < 50))
5254 msg_format("%s¤¬%s¤òÊñ¤ß¹þ¤â¤¦¤È¤·¤¿¤¬¡¢%s¤Ï¤½¤ì¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
5255 "¶²ÉݤΰŹõ¥ª¡¼¥é", "Ëɶñ", o_name);
5257 msg_format("A %s tries to %s, but your %s resists the effects!",
5258 "terrible black aura", "surround your armor", o_name);
5263 /* not artifact or failed save... */
5268 msg_format("¶²ÉݤΰŹõ¥ª¡¼¥é¤¬¤¢¤Ê¤¿¤Î%s¤òÊñ¤ß¹þ¤ó¤À¡ª", o_name);
5270 msg_format("A terrible black aura blasts your %s!", o_name);
5273 chg_virtue(V_ENCHANT, -5);
5275 /* Blast the armor */
5277 o_ptr->name2 = EGO_BLASTED;
5278 o_ptr->to_a = 0 - randint1(5) - randint1(5);
5284 o_ptr->art_flags1 = 0;
5285 o_ptr->art_flags2 = 0;
5286 o_ptr->art_flags3 = 0;
5289 o_ptr->ident |= (IDENT_CURSED);
5292 o_ptr->ident |= (IDENT_BROKEN);
5294 /* Recalculate bonuses */
5295 p_ptr->update |= (PU_BONUS);
5297 /* Recalculate mana */
5298 p_ptr->update |= (PU_MANA);
5301 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
5309 * Curse the players weapon
5311 bool curse_weapon(bool force, int slot)
5315 char o_name[MAX_NLEN];
5318 /* Curse the weapon */
5319 o_ptr = &inventory[slot];
5321 /* Nothing to curse */
5322 if (!o_ptr->k_idx) return (FALSE);
5326 object_desc(o_name, o_ptr, FALSE, 3);
5328 /* Attempt a saving throw */
5329 if ((artifact_p(o_ptr) || o_ptr->art_name) && (randint0(100) < 50) && !force)
5333 msg_format("%s¤¬%s¤òÊñ¤ß¹þ¤â¤¦¤È¤·¤¿¤¬¡¢%s¤Ï¤½¤ì¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
5334 "¶²ÉݤΰŹõ¥ª¡¼¥é", "Éð´ï", o_name);
5336 msg_format("A %s tries to %s, but your %s resists the effects!",
5337 "terrible black aura", "surround your weapon", o_name);
5342 /* not artifact or failed save... */
5347 if (!force) msg_format("¶²ÉݤΰŹõ¥ª¡¼¥é¤¬¤¢¤Ê¤¿¤Î%s¤òÊñ¤ß¹þ¤ó¤À¡ª", o_name);
5349 if (!force) msg_format("A terrible black aura blasts your %s!", o_name);
5352 chg_virtue(V_ENCHANT, -5);
5354 /* Shatter the weapon */
5356 o_ptr->name2 = EGO_SHATTERED;
5357 o_ptr->to_h = 0 - randint1(5) - randint1(5);
5358 o_ptr->to_d = 0 - randint1(5) - randint1(5);
5363 o_ptr->art_flags1 = 0;
5364 o_ptr->art_flags2 = 0;
5365 o_ptr->art_flags3 = 0;
5369 o_ptr->ident |= (IDENT_CURSED);
5372 o_ptr->ident |= (IDENT_BROKEN);
5374 /* Recalculate bonuses */
5375 p_ptr->update |= (PU_BONUS);
5377 /* Recalculate mana */
5378 p_ptr->update |= (PU_MANA);
5381 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
5390 * Enchant some bolts
5392 bool brand_bolts(void)
5396 /* Use the first acceptable bolts */
5397 for (i = 0; i < INVEN_PACK; i++)
5399 object_type *o_ptr = &inventory[i];
5401 /* Skip non-bolts */
5402 if (o_ptr->tval != TV_BOLT) continue;
5404 /* Skip artifacts and ego-items */
5405 if (o_ptr->art_name || artifact_p(o_ptr) || ego_item_p(o_ptr))
5408 /* Skip cursed/broken items */
5409 if (cursed_p(o_ptr) || broken_p(o_ptr)) continue;
5412 if (randint0(100) < 75) continue;
5416 msg_print("¥¯¥í¥¹¥Ü¥¦¤ÎÌ𤬱ê¤Î¥ª¡¼¥é¤ËÊñ¤Þ¤ì¤¿¡ª");
5418 msg_print("Your bolts are covered in a fiery aura!");
5423 o_ptr->name2 = EGO_FLAME;
5426 enchant(o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
5433 if (flush_failure) flush();
5437 msg_print("±ê¤Ç¶¯²½¤¹¤ë¤Î¤Ë¼ºÇÔ¤·¤¿¡£");
5439 msg_print("The fiery enchantment failed.");
5449 * Helper function -- return a "nearby" race for polymorphing
5451 * Note that this function is one of the more "dangerous" ones...
5453 static s16b poly_r_idx(int r_idx)
5455 monster_race *r_ptr = &r_info[r_idx];
5457 int i, r, lev1, lev2;
5459 /* Hack -- Uniques/Questors never polymorph */
5460 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5461 (r_ptr->flags1 & RF1_QUESTOR))
5464 /* Allowable range of "levels" for resulting monster */
5465 lev1 = r_ptr->level - ((randint1(20) / randint1(9)) + 1);
5466 lev2 = r_ptr->level + ((randint1(20) / randint1(9)) + 1);
5468 /* Pick a (possibly new) non-unique race */
5469 for (i = 0; i < 1000; i++)
5471 /* Pick a new race, using a level calculation */
5472 r = get_mon_num((dun_level + r_ptr->level) / 2 + 5);
5474 /* Handle failure */
5480 /* Ignore unique monsters */
5481 if (r_ptr->flags1 & RF1_UNIQUE) continue;
5483 /* Ignore monsters with incompatible levels */
5484 if ((r_ptr->level < lev1) || (r_ptr->level > lev2)) continue;
5486 /* Use that index */
5498 bool polymorph_monster(int y, int x)
5500 cave_type *c_ptr = &cave[y][x];
5501 monster_type *m_ptr = &m_list[c_ptr->m_idx];
5503 bool polymorphed = FALSE;
5505 int old_r_idx = m_ptr->r_idx;
5507 if (p_ptr->inside_arena || p_ptr->inside_battle) return (FALSE);
5509 if ((p_ptr->riding == c_ptr->m_idx) || (m_ptr->mflag2 & MFLAG_KAGE)) return (FALSE);
5511 /* Get the monsters attitude */
5512 friendly = is_friendly(m_ptr);
5513 pet = is_pet(m_ptr);
5515 /* Pick a "new" monster race */
5516 new_r_idx = poly_r_idx(old_r_idx);
5518 /* Handle polymorph */
5519 if (new_r_idx != old_r_idx)
5521 /* "Kill" the "old" monster */
5522 delete_monster_idx(c_ptr->m_idx);
5524 /* Create a new monster (no groups) */
5525 if (place_monster_aux(y, x, new_r_idx, FALSE, FALSE, friendly, pet, FALSE, (bool)(m_ptr->mflag2 & MFLAG_NOPET)))
5532 monster_terrain_sensitive = FALSE;
5534 /* Placing the new monster failed */
5535 place_monster_aux(y, x, old_r_idx, FALSE, FALSE, friendly, pet, TRUE, (bool)(m_ptr->mflag2 & MFLAG_NOPET));
5537 monster_terrain_sensitive = TRUE;
5548 bool dimension_door(void)
5550 int plev = p_ptr->lev;
5553 if (!tgt_pt(&x, &y)) return FALSE;
5555 p_ptr->energy -= 60 - plev;
5557 if (!cave_empty_bold(y, x) || (cave[y][x].info & CAVE_ICKY) ||
5558 (distance(y, x, py, px) > plev / 2 + 10) ||
5559 (!randint0(plev / 10 + 10)))
5561 if( p_ptr->pclass != CLASS_MIRROR_MASTER ){
5563 msg_print("ÀºÎ¤«¤éʪ¼Á³¦¤ËÌá¤ë»þ¤¦¤Þ¤¯¤¤¤«¤Ê¤«¤Ã¤¿¡ª");
5565 msg_print("You fail to exit the astral plane correctly!");
5570 msg_print("¶À¤ÎÀ¤³¦¤ò¤¦¤Þ¤¯Ä̤ì¤Ê¤«¤Ã¤¿¡ª");
5572 msg_print("You fail to exit the astral plane correctly!");
5575 p_ptr->energy -= 60 - plev;
5576 teleport_player((plev+2)*2);
5578 else teleport_player_to(y, x, TRUE);
5584 bool eat_magic(int power)
5586 object_type * o_ptr;
5589 int recharge_strength = 0;
5595 char o_name[MAX_NLEN];
5597 item_tester_hook = item_tester_hook_recharge;
5601 q = "¤É¤Î¥¢¥¤¥Æ¥à¤«¤éËâÎϤòµÛ¼ý¤·¤Þ¤¹¤«¡©";
5602 s = "ËâÎϤòµÛ¼ý¤Ç¤¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£";
5604 q = "Drain which item? ";
5605 s = "You have nothing to drain.";
5608 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return FALSE;
5612 o_ptr = &inventory[item];
5616 o_ptr = &o_list[0 - item];
5619 k_ptr = &k_info[o_ptr->k_idx];
5620 lev = get_object_level(o_ptr);
5622 if (o_ptr->tval == TV_ROD)
5624 recharge_strength = ((power > lev/2) ? (power - lev/2) : 0) / 5;
5627 if (one_in_(recharge_strength))
5629 /* Activate the failure code. */
5634 if (o_ptr->timeout > (o_ptr->number - 1) * k_ptr->pval)
5637 msg_print("½¼Å¶Ãæ¤Î¥í¥Ã¥É¤«¤éËâÎϤòµÛ¼ý¤¹¤ë¤³¤È¤Ï¤Ç¤¤Þ¤»¤ó¡£");
5639 msg_print("You can't absorb energy from a discharged rod.");
5646 o_ptr->timeout += k_ptr->pval;
5652 /* All staffs, wands. */
5653 recharge_strength = (100 + power - lev) / 15;
5656 if (recharge_strength < 0) recharge_strength = 0;
5659 if (one_in_(recharge_strength))
5661 /* Activate the failure code. */
5666 if (o_ptr->pval > 0)
5668 p_ptr->csp += lev / 2;
5671 /* XXX Hack -- unstack if necessary */
5672 if ((o_ptr->tval == TV_STAFF) && (item >= 0) && (o_ptr->number > 1))
5677 /* Get local object */
5680 /* Obtain a local object */
5681 object_copy(q_ptr, o_ptr);
5683 /* Modify quantity */
5686 /* Restore the charges */
5689 /* Unstack the used item */
5691 p_ptr->total_weight -= q_ptr->weight;
5692 item = inven_carry(q_ptr);
5696 msg_print("¾ó¤ò¤Þ¤È¤á¤Ê¤ª¤·¤¿¡£");
5698 msg_print("You unstack your staff.");
5706 msg_print("µÛ¼ý¤Ç¤¤ëËâÎϤ¬¤¢¤ê¤Þ¤»¤ó¡ª");
5708 msg_print("There's no energy there to absorb!");
5712 if (!o_ptr->pval) o_ptr->ident |= IDENT_EMPTY;
5716 /* Inflict the penalties for failing a recharge. */
5719 /* Artifacts are never destroyed. */
5720 if (artifact_p(o_ptr))
5722 object_desc(o_name, o_ptr, TRUE, 0);
5724 msg_format("ËâÎϤ¬µÕή¤·¤¿¡ª%s¤Ï´°Á´¤ËËâÎϤò¼º¤Ã¤¿¡£", o_name);
5726 msg_format("The recharging backfires - %s is completely drained!", o_name);
5730 /* Artifact rods. */
5731 if (o_ptr->tval == TV_ROD)
5732 o_ptr->timeout = k_ptr->pval * o_ptr->number;
5734 /* Artifact wands and staffs. */
5735 else if ((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_STAFF))
5740 /* Get the object description */
5741 object_desc(o_name, o_ptr, FALSE, 0);
5743 /*** Determine Seriousness of Failure ***/
5745 /* Mages recharge objects more safely. */
5746 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)
5748 /* 10% chance to blow up one rod, otherwise draining. */
5749 if (o_ptr->tval == TV_ROD)
5751 if (one_in_(10)) fail_type = 2;
5754 /* 75% chance to blow up one wand, otherwise draining. */
5755 else if (o_ptr->tval == TV_WAND)
5757 if (!one_in_(3)) fail_type = 2;
5760 /* 50% chance to blow up one staff, otherwise no effect. */
5761 else if (o_ptr->tval == TV_STAFF)
5763 if (one_in_(2)) fail_type = 2;
5768 /* All other classes get no special favors. */
5771 /* 33% chance to blow up one rod, otherwise draining. */
5772 if (o_ptr->tval == TV_ROD)
5774 if (one_in_(3)) fail_type = 2;
5777 /* 20% chance of the entire stack, else destroy one wand. */
5778 else if (o_ptr->tval == TV_WAND)
5780 if (one_in_(5)) fail_type = 3;
5783 /* Blow up one staff. */
5784 else if (o_ptr->tval == TV_STAFF)
5790 /*** Apply draining and destruction. ***/
5792 /* Drain object or stack of objects. */
5795 if (o_ptr->tval == TV_ROD)
5798 msg_print("ËâÎϤ¬µÕÊ®¼Í¤·¤Æ¡¢¥í¥Ã¥É¤«¤é¤µ¤é¤ËËâÎϤòµÛ¤¤¼è¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
5800 msg_print("The recharge backfires, draining the rod further!");
5803 o_ptr->timeout = k_ptr->pval * o_ptr->number;
5805 else if (o_ptr->tval == TV_WAND)
5808 msg_format("%s¤ÏÇË»¤òÌȤ줿¤¬¡¢ËâÎϤ¬Á´¤Æ¼º¤ï¤ì¤¿¡£", o_name);
5810 msg_format("You save your %s from destruction, but all charges are lost.", o_name);
5815 /* Staffs aren't drained. */
5818 /* Destroy an object or one in a stack of objects. */
5821 if (o_ptr->number > 1)
5824 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬°ìËܲõ¤ì¤¿¡ª", o_name);
5826 msg_format("Wild magic consumes one of your %s!", o_name);
5829 /* Reduce rod stack maximum timeout, drain wands. */
5830 if (o_ptr->tval == TV_ROD) o_ptr->timeout -= k_ptr->pval;
5831 if (o_ptr->tval == TV_WAND) o_ptr->pval = o_ptr->pval * (o_ptr->number - 1) / o_ptr->number;
5836 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²¿Ëܤ«²õ¤ì¤¿¡ª", o_name);
5838 msg_format("Wild magic consumes your %s!", o_name);
5841 /* Reduce and describe inventory */
5844 inven_item_increase(item, -1);
5845 inven_item_describe(item);
5846 inven_item_optimize(item);
5849 /* Reduce and describe floor item */
5852 floor_item_increase(0 - item, -1);
5853 floor_item_describe(0 - item);
5854 floor_item_optimize(0 - item);
5858 /* Destroy all members of a stack of objects. */
5861 if (o_ptr->number > 1)
5863 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬Á´¤Æ²õ¤ì¤¿¡ª", o_name);
5865 msg_format("Wild magic consumes all your %s!", o_name);
5870 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²õ¤ì¤¿¡ª", o_name);
5872 msg_format("Wild magic consumes your %s!", o_name);
5877 /* Reduce and describe inventory */
5880 inven_item_increase(item, -999);
5881 inven_item_describe(item);
5882 inven_item_optimize(item);
5885 /* Reduce and describe floor item */
5888 floor_item_increase(0 - item, -999);
5889 floor_item_describe(0 - item);
5890 floor_item_optimize(0 - item);
5896 if (p_ptr->csp > p_ptr->msp)
5898 p_ptr->csp = p_ptr->msp;
5901 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
5902 p_ptr->window |= (PW_INVEN);
5908 bool summon_kin_player(bool pet, int level, int y, int x, bool group)
5910 switch (p_ptr->mimic_form)
5913 switch (p_ptr->prace)
5917 case RACE_BARBARIAN:
5920 summon_kin_type = 'p';
5930 case RACE_MIND_FLAYER:
5933 summon_kin_type = 'h';
5936 summon_kin_type = 'o';
5938 case RACE_HALF_TROLL:
5939 summon_kin_type = 'T';
5941 case RACE_HALF_OGRE:
5942 summon_kin_type = 'O';
5944 case RACE_HALF_GIANT:
5945 case RACE_HALF_TITAN:
5947 summon_kin_type = 'P';
5950 summon_kin_type = 'y';
5953 summon_kin_type = 'K';
5956 summon_kin_type = 'k';
5959 if (one_in_(13)) summon_kin_type = 'U';
5960 else summon_kin_type = 'u';
5962 case RACE_DRACONIAN:
5963 summon_kin_type = 'd';
5967 summon_kin_type = 'g';
5970 if (one_in_(13)) summon_kin_type = 'L';
5971 else summon_kin_type = 's';
5974 summon_kin_type = 'z';
5977 summon_kin_type = 'V';
5980 summon_kin_type = 'G';
5983 summon_kin_type = 'I';
5986 summon_kin_type = '#';
5989 summon_kin_type = 'A';
5992 summon_kin_type = 'U';
5995 summon_kin_type = 'p';
6000 if (one_in_(13)) summon_kin_type = 'U';
6001 else summon_kin_type = 'u';
6003 case MIMIC_DEMON_LORD:
6004 summon_kin_type = 'U';
6007 summon_kin_type = 'V';
6010 return summon_specific((pet ? -1 : 0), y, x, level, SUMMON_KIN, group, FALSE, pet, FALSE, (bool)(!pet));