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+randint(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 /* Update the monster (new location) */
126 update_mon(m_idx, TRUE);
128 /* Redraw the old grid */
131 /* Redraw the new grid */
140 * Teleport monster next to the player
142 void teleport_to_player(int m_idx, int power)
144 int ny, nx, oy, ox, d, i, min;
148 monster_type *m_ptr = &m_list[m_idx];
152 if (!m_ptr->r_idx) return;
155 if (randint(100) > power) return;
161 /* Save the old location */
165 /* Minimum distance */
168 /* Look until done */
169 while (look && --attempts)
171 /* Verify max distance */
172 if (dis > 200) dis = 200;
174 /* Try several locations */
175 for (i = 0; i < 500; i++)
177 /* Pick a (possibly illegal) location */
180 ny = rand_spread(py, dis);
181 nx = rand_spread(px, dis);
182 d = distance(py, px, ny, nx);
183 if ((d >= min) && (d <= dis)) break;
186 /* Ignore illegal locations */
187 if (!in_bounds(ny, nx)) continue;
189 /* Require "empty" floor space */
190 if (!cave_empty_bold(ny, nx)) continue;
192 /* Hack -- no teleport onto glyph of warding */
193 if (cave[ny][nx].feat == FEAT_GLYPH) continue;
194 if (cave[ny][nx].feat == FEAT_MINOR_GLYPH) continue;
196 /* ...nor onto the Pattern */
197 if ((cave[ny][nx].feat >= FEAT_PATTERN_START) &&
198 (cave[ny][nx].feat <= FEAT_PATTERN_XTRA2)) continue;
200 /* No teleporting into vaults and such */
201 /* if (cave[ny][nx].info & (CAVE_ICKY)) continue; */
203 /* This grid looks good */
210 /* Increase the maximum distance */
213 /* Decrease the minimum distance */
217 if (attempts < 1) return;
220 sound(SOUND_TPOTHER);
222 /* Update the new location */
223 cave[ny][nx].m_idx = m_idx;
225 /* Update the old location */
226 cave[oy][ox].m_idx = 0;
228 /* Move the monster */
232 /* Update the monster (new location) */
233 update_mon(m_idx, TRUE);
235 /* Redraw the old grid */
238 /* Redraw the new grid */
241 p_ptr->update |= (PU_MON_LITE);
246 * Teleport the player to a location up to "dis" grids away.
248 * If no such spaces are readily available, the distance may increase.
249 * Try very hard to move the player at least a quarter that distance.
251 * When long-range teleport effects are considered, there is a nasty
252 * tendency to "bounce" the player between two or three different spots
253 * because these are the only spots that are "far enough" way to satisfy
254 * the algorithm. Therefore, if the teleport distance is more than 50,
255 * we decrease the minimum acceptable distance to try to increase randomness.
258 void teleport_player(int dis)
260 int d, i, min, ox, oy;
263 int xx = -1, yy = -1;
271 if (p_ptr->wild_mode) return;
273 if (p_ptr->anti_tele)
276 msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
278 msg_print("A mysterious force prevents you from teleporting!");
284 if (dis > 200) dis = 200; /* To be on the safe side... */
286 /* Minimum distance */
287 min = dis / (dis > 50 ? 3 : 2);
289 /* Look until done */
294 /* Verify max distance */
295 if (dis > 200) dis = 200;
297 /* Try several locations */
298 for (i = 0; i < 500; i++)
300 /* Pick a (possibly illegal) location */
303 y = rand_spread(py, dis);
304 x = rand_spread(px, dis);
305 d = distance(py, px, y, x);
306 if ((d >= min) && (d <= dis)) break;
309 /* Ignore illegal locations */
310 if (!in_bounds(y, x)) continue;
312 /* Require "naked" floor space or trees */
313 if (!(cave_naked_bold(y, x) ||
314 (cave[y][x].feat == FEAT_TREES))) continue;
316 /* No teleporting into vaults and such */
317 if (cave[y][x].info & CAVE_ICKY) continue;
319 /* This grid looks good */
326 /* Increase the maximum distance */
329 /* Decrease the minimum distance */
332 /* Stop after MAX_TRIES tries */
333 if (tries > MAX_TRIES) return;
337 sound(SOUND_TELEPORT);
340 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
341 msg_format("¡Ø¤³¤Ã¤Á¤À¤¡¡¢%s¡Ù", player_name);
344 /* Save the old location */
348 /* Move the player */
355 tmp = cave[py][px].m_idx;
356 cave[py][px].m_idx = cave[oy][ox].m_idx;
357 cave[oy][ox].m_idx = tmp;
358 m_list[p_ptr->riding].fy = py;
359 m_list[p_ptr->riding].fx = px;
360 update_mon(cave[py][px].m_idx, TRUE);
363 /* Redraw the old spot */
366 /* Monsters with teleport ability may follow the player */
373 if (xx == 0 && yy == 0)
379 if (cave[oy+yy][ox+xx].m_idx)
381 if ((r_info[m_list[cave[oy+yy][ox+xx].m_idx].r_idx].flags6 & RF6_TPORT) &&
382 !(r_info[m_list[cave[oy+yy][ox+xx].m_idx].r_idx].flags3 & RF3_RES_TELE))
384 * The latter limitation is to avoid
385 * totally unkillable suckers...
388 if (!(m_list[cave[oy+yy][ox+xx].m_idx].csleep))
389 teleport_to_player(cave[oy+yy][ox+xx].m_idx, r_info[m_list[cave[oy+yy][ox+xx].m_idx].r_idx].level);
400 /* Redraw the new spot */
403 /* Check for new panel (redraw map) */
407 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
409 /* Update the monsters */
410 p_ptr->update |= (PU_DISTANCE);
413 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
415 /* Handle stuff XXX XXX XXX */
422 * Teleport player to a grid near the given location
424 * This function is slightly obsessive about correctness.
425 * This function allows teleporting into vaults (!)
427 void teleport_player_to(int ny, int nx, bool no_tele)
429 int y, x, oy, ox, dis = 0, ctr = 0;
431 if (p_ptr->anti_tele && no_tele)
434 msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
436 msg_print("A mysterious force prevents you from teleporting!");
442 /* Find a usable location */
445 /* Pick a nearby legal location */
448 y = rand_spread(ny, dis);
449 x = rand_spread(nx, dis);
450 if (in_bounds(y, x)) break;
453 /* Accept "naked" floor grids */
456 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;
458 else if (cave_empty_bold(y, x) || ((y == py) && (x == px))) break;
460 /* Occasionally advance the distance */
461 if (++ctr > (4 * dis * dis + 4 * dis + 1))
469 sound(SOUND_TELEPORT);
471 /* Save the old location */
475 /* Move the player */
482 tmp = cave[py][px].m_idx;
483 cave[py][px].m_idx = cave[oy][ox].m_idx;
484 cave[oy][ox].m_idx = tmp;
485 m_list[p_ptr->riding].fy = py;
486 m_list[p_ptr->riding].fx = px;
487 update_mon(cave[py][px].m_idx, TRUE);
492 /* Redraw the old spot */
495 /* Redraw the new spot */
498 /* Check for new panel (redraw map) */
502 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
504 /* Update the monsters */
505 p_ptr->update |= (PU_DISTANCE);
508 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
510 /* Handle stuff XXX XXX XXX */
517 * Teleport the player one level up or down (random when legal)
519 void teleport_player_level(void)
521 /* No effect in arena or quest */
522 if (p_ptr->inside_arena || (p_ptr->inside_quest && !random_quest_number(dun_level)) ||
523 (quest_number(dun_level) && (dun_level > 1) && ironman_downward))
526 msg_print("¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£");
528 msg_print("There is no effect.");
534 if (p_ptr->anti_tele)
537 msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
539 msg_print("A mysterious force prevents you from teleporting!");
545 if (ironman_downward || (dun_level <= d_info[dungeon_type].mindepth))
548 msg_print("¤¢¤Ê¤¿¤Ï¾²¤òÆͤÇˤäÆÄÀ¤ó¤Ç¤¤¤¯¡£");
550 msg_print("You sink through the floor.");
554 dungeon_type = p_ptr->recall_dungeon;
559 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL);
561 if (autosave_l) do_cmd_save_game(TRUE);
565 dun_level = d_info[dungeon_type].mindepth;
573 p_ptr->leaving = TRUE;
575 else if (quest_number(dun_level) || (dun_level >= d_info[dungeon_type].maxdepth))
578 msg_print("¤¢¤Ê¤¿¤ÏÅ·°æ¤òÆͤÇˤäÆÃè¤ØÉ⤤¤Æ¤¤¤¯¡£");
580 msg_print("You rise up through the ceiling.");
584 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, -1, NULL);
586 if (autosave_l) do_cmd_save_game(TRUE);
590 if (!dun_level) dungeon_type = 0;
592 leaving_quest = p_ptr->inside_quest;
595 ((quest[leaving_quest].flags & QUEST_FLAG_ONCE) || (quest[leaving_quest].type == QUEST_TYPE_RANDOM)) &&
596 (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
598 quest[leaving_quest].status = QUEST_STATUS_FAILED;
599 quest[leaving_quest].complev = (byte)p_ptr->lev;
600 if (quest[leaving_quest].type == QUEST_TYPE_RANDOM)
602 r_info[quest[leaving_quest].r_idx].flags1 &= ~(RF1_QUESTOR);
603 if (record_rand_quest)
604 do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
606 else if (record_fix_quest)
607 do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
611 p_ptr->inside_quest = 0;
612 p_ptr->leaving = TRUE;
614 else if (rand_int(100) < 50)
617 msg_print("¤¢¤Ê¤¿¤ÏÅ·°æ¤òÆͤÇˤäÆÃè¤ØÉ⤤¤Æ¤¤¤¯¡£");
619 msg_print("You rise up through the ceiling.");
623 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, -1, NULL);
625 if (autosave_l) do_cmd_save_game(TRUE);
629 if (!dun_level) dungeon_type = 0;
632 p_ptr->leaving = TRUE;
637 msg_print("¤¢¤Ê¤¿¤Ï¾²¤òÆͤÇˤäÆÄÀ¤ó¤Ç¤¤¤¯¡£");
639 msg_print("You sink through the floor.");
642 if (!dun_level) dungeon_type = p_ptr->recall_dungeon;
644 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL);
646 if (autosave_l) do_cmd_save_game(TRUE);
651 p_ptr->leaving = TRUE;
654 if (!dun_level && dungeon_type)
656 p_ptr->leaving_dungeon = TRUE;
657 p_ptr->wilderness_y = d_info[dungeon_type].dy;
658 p_ptr->wilderness_x = d_info[dungeon_type].dx;
659 p_ptr->recall_dungeon = dungeon_type;
662 if (!dun_level) dungeon_type = 0;
665 sound(SOUND_TPLEVEL);
670 static int choose_dungeon(cptr note)
676 /* Allocate the "dun" array */
677 C_MAKE(dun, max_d_idx, s16b);
680 for(i = 1; i < max_d_idx; i++)
685 if (!d_info[i].maxdepth) continue;
686 if (!max_dlv[i]) continue;
687 if (d_info[i].final_guardian)
689 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
691 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
694 sprintf(buf," %c) %c%-12s : ºÇÂç %d ³¬", 'a'+num, seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
696 sprintf(buf," %c) %c%-16s : Max level %d", 'a'+num, seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
702 prt(format("¤É¤Î¥À¥ó¥¸¥ç¥ó%s¤·¤Þ¤¹¤«:", note), 0, 0);
704 prt(format("Which dungeon do you %s?: ", note), 0, 0);
711 /* Free the "dun" array */
712 C_KILL(dun, max_d_idx, s16b);
717 if (i >= 'a' && i <('a'+num))
719 select_dungeon = dun[i-'a'];
726 /* Free the "dun" array */
727 C_KILL(dun, max_d_idx, s16b);
729 return select_dungeon;
734 * Recall the player to town or dungeon
736 bool recall_player(int turns)
739 * TODO: Recall the player to the last
740 * visited town when in the wilderness
744 if (p_ptr->inside_arena || ironman_downward)
747 msg_print("²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
749 msg_print("Nothing happens.");
755 if (dun_level && (max_dlv[dungeon_type] > dun_level) && !p_ptr->inside_quest && !p_ptr->word_recall)
758 if (get_check("¤³¤³¤ÏºÇ¿¼Åþ㳬¤è¤êÀõ¤¤³¬¤Ç¤¹¡£¤³¤Î³¬¤ËÌá¤Ã¤ÆÍè¤Þ¤¹¤«¡© "))
760 if (get_check("Reset recall depth? "))
763 max_dlv[dungeon_type] = dun_level;
764 if (record_maxdeapth)
766 do_cmd_write_nikki(NIKKI_TRUMP, dungeon_type, "µ¢´Ô¤Î¤È¤¤Ë");
768 do_cmd_write_nikki(NIKKI_TRUMP, dungeon_type, "when recall from dungeon");
773 if (!p_ptr->word_recall)
779 select_dungeon = choose_dungeon("¤Ëµ¢´Ô");
781 select_dungeon = choose_dungeon("recall");
783 if (!select_dungeon) return FALSE;
784 p_ptr->recall_dungeon = select_dungeon;
786 p_ptr->word_recall = turns;
788 msg_print("²ó¤ê¤ÎÂ絤¤¬Ä¥¤ê¤Ä¤á¤Æ¤¤¿...");
790 msg_print("The air about you becomes charged...");
793 p_ptr->redraw |= (PR_STATUS);
797 p_ptr->word_recall = 0;
799 msg_print("Ä¥¤ê¤Ä¤á¤¿Â絤¤¬Î®¤ìµî¤Ã¤¿...");
801 msg_print("A tension leaves the air around you...");
804 p_ptr->redraw |= (PR_STATUS);
810 bool word_of_recall(void)
812 return(recall_player(rand_int(21) + 15));
816 bool reset_recall(void)
818 int select_dungeon, dummy = 0;
823 select_dungeon = choose_dungeon("¤ò¥»¥Ã¥È");
825 select_dungeon = choose_dungeon("reset");
828 if (!select_dungeon) return FALSE;
831 sprintf(ppp, "²¿³¬¤Ë¥»¥Ã¥È¤·¤Þ¤¹¤« (%d-%d):", d_info[select_dungeon].mindepth, max_dlv[select_dungeon]);
833 sprintf(ppp, "Reset to which level (%d-%d): ", d_info[select_dungeon].mindepth, max_dlv[select_dungeon]);
838 sprintf(tmp_val, "%d", MAX(dun_level, 1));
840 /* Ask for a level */
841 if (get_string(ppp, tmp_val, 10))
843 /* Extract request */
844 dummy = atoi(tmp_val);
847 if (dummy < 1) dummy = 1;
850 if (dummy > max_dlv[select_dungeon]) dummy = max_dlv[select_dungeon];
851 if (dummy < d_info[select_dungeon].mindepth) dummy = d_info[select_dungeon].mindepth;
853 max_dlv[select_dungeon] = dummy;
855 if (record_maxdeapth)
857 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "¥Õ¥í¥¢¡¦¥ê¥»¥Ã¥È¤Ç");
859 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "using a scroll of reset recall");
863 msg_format("%s¤Îµ¢´Ô¥ì¥Ù¥ë¤ò %d ³¬¤Ë¥»¥Ã¥È¡£", d_name+d_info[select_dungeon].name, dummy, dummy * 50);
865 msg_format("Recall depth set to level %d (%d').", dummy, dummy * 50);
878 * Apply disenchantment to the player's stuff
880 * XXX XXX XXX This function is also called from the "melee" code
882 * The "mode" is currently unused.
884 * Return "TRUE" if the player notices anything
886 bool apply_disenchant(int mode)
890 char o_name[MAX_NLEN];
897 /* Pick a random slot */
900 case 1: t = INVEN_RARM; break;
901 case 2: t = INVEN_LARM; break;
902 case 3: t = INVEN_BOW; break;
903 case 4: t = INVEN_BODY; break;
904 case 5: t = INVEN_OUTER; break;
905 case 6: t = INVEN_HEAD; break;
906 case 7: t = INVEN_HANDS; break;
907 case 8: t = INVEN_FEET; break;
911 o_ptr = &inventory[t];
913 /* No item, nothing happens */
914 if (!o_ptr->k_idx) return (FALSE);
917 /* Nothing to disenchant */
918 if ((o_ptr->to_h <= 0) && (o_ptr->to_d <= 0) && (o_ptr->to_a <= 0))
920 /* Nothing to notice */
925 /* Describe the object */
926 object_desc(o_name, o_ptr, FALSE, 0);
929 /* Artifacts have 71% chance to resist */
930 if ((artifact_p(o_ptr) || o_ptr->art_name) && (rand_int(100) < 71))
934 msg_format("%s(%c)¤ÏÎô²½¤òÄ·¤ÍÊÖ¤·¤¿¡ª",o_name, index_to_label(t) );
936 msg_format("Your %s (%c) resist%s disenchantment!",
937 o_name, index_to_label(t),
938 ((o_ptr->number != 1) ? "" : "s"));
947 /* Disenchant tohit */
948 if (o_ptr->to_h > 0) o_ptr->to_h--;
949 if ((o_ptr->to_h > 5) && (rand_int(100) < 20)) o_ptr->to_h--;
951 /* Disenchant todam */
952 if (o_ptr->to_d > 0) o_ptr->to_d--;
953 if ((o_ptr->to_d > 5) && (rand_int(100) < 20)) o_ptr->to_d--;
955 /* Disenchant toac */
956 if (o_ptr->to_a > 0) o_ptr->to_a--;
957 if ((o_ptr->to_a > 5) && (rand_int(100) < 20)) o_ptr->to_a--;
961 msg_format("%s(%c)¤ÏÎô²½¤·¤Æ¤·¤Þ¤Ã¤¿¡ª",
962 o_name, index_to_label(t) );
964 msg_format("Your %s (%c) %s disenchanted!",
965 o_name, index_to_label(t),
966 ((o_ptr->number != 1) ? "were" : "was"));
969 chg_virtue(V_HARMONY, 1);
970 chg_virtue(V_ENCHANT, -2);
972 /* Recalculate bonuses */
973 p_ptr->update |= (PU_BONUS);
976 p_ptr->window |= (PW_EQUIP | PW_PLAYER);
985 void mutate_player(void)
987 int max1, cur1, max2, cur2, ii, jj, i;
989 /* Pick a pair of stats */
991 for (jj = ii; jj == ii; jj = rand_int(6)) /* loop */;
993 max1 = p_ptr->stat_max[ii];
994 cur1 = p_ptr->stat_cur[ii];
995 max2 = p_ptr->stat_max[jj];
996 cur2 = p_ptr->stat_cur[jj];
998 p_ptr->stat_max[ii] = max2;
999 p_ptr->stat_cur[ii] = cur2;
1000 p_ptr->stat_max[jj] = max1;
1001 p_ptr->stat_cur[jj] = cur1;
1005 if(p_ptr->stat_max[i] > p_ptr->stat_max_max[i]) p_ptr->stat_max[i] = p_ptr->stat_max_max[i];
1006 if(p_ptr->stat_cur[i] > p_ptr->stat_max_max[i]) p_ptr->stat_cur[i] = p_ptr->stat_max_max[i];
1009 p_ptr->update |= (PU_BONUS);
1016 void apply_nexus(monster_type *m_ptr)
1020 case 1: case 2: case 3:
1022 teleport_player(200);
1028 teleport_player_to(m_ptr->fy, m_ptr->fx, TRUE);
1034 if (rand_int(100) < p_ptr->skill_sav)
1037 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
1039 msg_print("You resist the effects!");
1045 /* Teleport Level */
1046 teleport_player_level();
1052 if (rand_int(100) < p_ptr->skill_sav)
1055 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
1057 msg_print("You resist the effects!");
1064 msg_print("ÂΤ¬¤Í¤¸¤ì»Ï¤á¤¿...");
1066 msg_print("Your body starts to scramble...");
1077 * Charge a lite (torch or latern)
1079 void phlogiston(void)
1082 object_type * o_ptr = &inventory[INVEN_LITE];
1085 if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_LANTERN))
1087 max_flog = FUEL_LAMP;
1091 else if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_TORCH))
1093 max_flog = FUEL_TORCH;
1096 /* No torch to refill */
1100 msg_print("dzÁǤò¾ÃÈñ¤¹¤ë¥¢¥¤¥Æ¥à¤òÁõÈ÷¤·¤Æ¤¤¤Þ¤»¤ó¡£");
1102 msg_print("You are not wielding anything which uses phlogiston.");
1108 if (o_ptr->xtra4 >= max_flog)
1111 msg_print("¤³¤Î¥¢¥¤¥Æ¥à¤Ë¤Ï¤³¤ì°Ê¾ådzÁǤòÊä½¼¤Ç¤¤Þ¤»¤ó¡£");
1113 msg_print("No more phlogiston can be put in this item.");
1120 o_ptr->xtra4 += (max_flog / 2);
1124 msg_print("¾ÈÌÀÍÑ¥¢¥¤¥Æ¥à¤ËdzÁǤòÊä½¼¤·¤¿¡£");
1126 msg_print("You add phlogiston to your light item.");
1131 if (o_ptr->xtra4 >= max_flog)
1133 o_ptr->xtra4 = max_flog;
1135 msg_print("¾ÈÌÀÍÑ¥¢¥¤¥Æ¥à¤ÏËþ¥¿¥ó¤Ë¤Ê¤Ã¤¿¡£");
1137 msg_print("Your light item is full.");
1142 /* Recalculate torch */
1143 p_ptr->update |= (PU_TORCH);
1147 bool item_tester_hook_weapon_nobow(object_type *o_ptr)
1149 switch (o_ptr->tval)
1159 if (o_ptr->sval != SV_DOKUBARI) return (TRUE);
1167 * Brand the current weapon
1169 void brand_weapon(int brand_type)
1176 /* Assume enchant weapon */
1177 item_tester_hook = item_tester_hook_weapon_nobow;
1178 item_tester_no_ryoute = TRUE;
1182 q = "¤É¤ÎÉð´ï¤ò¶¯²½¤·¤Þ¤¹¤«? ";
1183 s = "¶¯²½¤Ç¤¤ëÉð´ï¤¬¤Ê¤¤¡£";
1185 q = "Enchant which weapon? ";
1186 s = "You have nothing to enchant.";
1189 if (!get_item(&item, q, s, (USE_EQUIP))) return;
1191 /* Get the item (in the pack) */
1194 o_ptr = &inventory[item];
1197 /* Get the item (on the floor) */
1200 o_ptr = &o_list[0 - item];
1204 /* you can never modify artifacts / ego-items */
1205 /* you can never modify cursed items */
1206 /* TY: You _can_ modify broken items (if you're silly enough) */
1207 if (o_ptr->k_idx && !artifact_p(o_ptr) && !ego_item_p(o_ptr) &&
1208 !o_ptr->art_name && !cursed_p(o_ptr) &&
1209 !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) &&
1210 !((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE)) &&
1211 !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DIAMOND_EDGE)))
1215 /* Let's get the name before it is changed... */
1216 char o_name[MAX_NLEN];
1217 object_desc(o_name, o_ptr, FALSE, 0);
1222 if (o_ptr->tval == TV_SWORD)
1225 act = "¤Ï±Ô¤µ¤òÁý¤·¤¿¡ª";
1227 act = "becomes very sharp!";
1230 o_ptr->name2 = EGO_SHARPNESS;
1231 o_ptr->pval = m_bonus(5, dun_level) + 1;
1236 act = "¤ÏÇ˲õÎϤòÁý¤·¤¿¡ª";
1238 act = "seems very powerful.";
1241 o_ptr->name2 = EGO_EARTHQUAKES;
1242 o_ptr->pval = m_bonus(3, dun_level);
1247 act = "¤ÏÅÅ·â¤Ëʤ¤ï¤ì¤¿¡ª";
1249 act = "coverd with lightning!";
1252 o_ptr->name2 = EGO_BRAND_ELEC;
1256 act = "¤Ï»À¤Ëʤ¤ï¤ì¤¿¡ª";
1258 act = "coated with acid!";
1261 o_ptr->name2 = EGO_BRAND_ACID;
1265 act = "¤Ï¼Ù°¤Ê¤ë²øʪ¤òµá¤á¤Æ¤¤¤ë¡ª";
1267 act = "seems looking for evil monster!";
1270 o_ptr->name2 = EGO_SLAY_EVIL;
1274 act = "¤Ï°ÛÀ¤³¦¤Î½»¿Í¤ÎÆùÂΤòµá¤á¤Æ¤¤¤ë¡ª";
1276 act = "seems looking for demon!";
1279 o_ptr->name2 = EGO_SLAY_DEMON;
1283 act = "¤Ï»Ó¤òµá¤á¤Æ¤¤¤ë¡ª";
1285 act = "seems looking for undead!";
1288 o_ptr->name2 = EGO_SLAY_UNDEAD;
1292 act = "¤Ïưʪ¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1294 act = "seems looking for animal!";
1297 o_ptr->name2 = EGO_SLAY_ANIMAL;
1301 act = "¤Ï¥É¥é¥´¥ó¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1303 act = "seems looking for dragon!";
1306 o_ptr->name2 = EGO_SLAY_DRAGON;
1310 act = "¤Ï¥È¥í¥ë¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1312 act = "seems looking for troll!";
1315 o_ptr->name2 = EGO_SLAY_TROLL;
1319 act = "¤Ï¥ª¡¼¥¯¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1321 act = "seems looking for orc!";
1324 o_ptr->name2 = EGO_SLAY_ORC;
1328 act = "¤Ïµð¿Í¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1330 act = "seems looking for giant!";
1333 o_ptr->name2 = EGO_SLAY_GIANT;
1337 act = "¤ÏÈó¾ï¤ËÉÔ°ÂÄê¤Ë¤Ê¤Ã¤¿¤è¤¦¤À¡£";
1339 act = "seems very unstable now.";
1342 o_ptr->name2 = EGO_TRUMP;
1343 o_ptr->pval = randint(2);
1347 act = "¤Ï·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1349 act = "thirsts for blood!";
1352 o_ptr->name2 = EGO_VAMPIRIC;
1356 act = "¤ÏÆǤËʤ¤ï¤ì¤¿¡£";
1358 act = "is coated with poison.";
1361 o_ptr->name2 = EGO_BRAND_POIS;
1365 act = "¤Ï½ã¥í¥°¥ë¥¹¤Ë°û¤ß¹þ¤Þ¤ì¤¿¡£";
1367 act = "is engulfed in raw Logrus!";
1370 o_ptr->name2 = EGO_CHAOTIC;
1374 act = "¤Ï±ê¤Î¥·¡¼¥ë¥É¤Ëʤ¤ï¤ì¤¿¡ª";
1376 act = "is covered in a fiery shield!";
1379 o_ptr->name2 = EGO_BRAND_FIRE;
1383 act = "¤Ï¿¼¤¯Î䤿¤¤¥Ö¥ë¡¼¤Ëµ±¤¤¤¿¡ª";
1385 act = "glows deep, icy blue!";
1388 o_ptr->name2 = EGO_BRAND_COLD;
1393 msg_format("¤¢¤Ê¤¿¤Î%s%s", o_name, act);
1395 msg_format("Your %s %s", o_name, act);
1399 enchant(o_ptr, rand_int(3) + 4, ENCH_TOHIT | ENCH_TODAM);
1401 o_ptr->discount = 99;
1402 chg_virtue(V_ENCHANT, 2);
1406 if (flush_failure) flush();
1409 msg_print("°ÀÉղä˼ºÇÔ¤·¤¿¡£");
1411 msg_print("The Branding failed.");
1414 chg_virtue(V_ENCHANT, -2);
1420 void call_the_(void)
1424 if (cave_floor_bold(py - 1, px - 1) &&
1425 cave_floor_bold(py - 1, px ) &&
1426 cave_floor_bold(py - 1, px + 1) &&
1427 cave_floor_bold(py , px - 1) &&
1428 cave_floor_bold(py , px + 1) &&
1429 cave_floor_bold(py + 1, px - 1) &&
1430 cave_floor_bold(py + 1, px ) &&
1431 cave_floor_bold(py + 1, px + 1))
1433 for (i = 1; i < 10; i++)
1435 if (i-5) fire_ball(GF_ROCKET, i, 175, 2);
1438 for (i = 1; i < 10; i++)
1440 if (i-5) fire_ball(GF_MANA, i, 175, 3);
1443 for (i = 1; i < 10; i++)
1445 if (i-5) fire_ball(GF_NUKE, i, 175, 4);
1451 msg_format("¤¢¤Ê¤¿¤Ï%s¤òÊɤ˶᤹¤®¤ë¾ì½ê¤Ç¾§¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª",
1452 ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "µ§¤ê" : "¼öʸ"));
1453 msg_print("Â礤ÊÇúȯ²»¤¬¤¢¤Ã¤¿¡ª");
1455 msg_format("You %s the %s too close to a wall!",
1456 ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "recite" : "cast"),
1457 ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "prayer" : "spell"));
1458 msg_print("There is a loud explosion!");
1462 if (destroy_area(py, px, 15 + p_ptr->lev + rand_int(11), TRUE))
1464 msg_print("¥À¥ó¥¸¥ç¥ó¤¬Êø²õ¤·¤¿...");
1466 msg_print("The dungeon collapses...");
1471 msg_print("¥À¥ó¥¸¥ç¥ó¤ÏÂ礤¯Íɤ줿¡£");
1473 msg_print("The dungeon trembles.");
1478 take_hit(DAMAGE_NOESCAPE, 100 + randint(150), "¼«»¦Åª¤Êµõ̵¾·Íè", -1);
1480 take_hit(DAMAGE_NOESCAPE, 100 + randint(150), "a suicidal Call the Void", -1);
1488 * Fetch an item (teleport it right underneath the caster)
1490 void fetch(int dir, int wgt, bool require_los)
1496 char o_name[MAX_NLEN];
1498 /* Check to see if an object is already there */
1499 if (cave[py][px].o_idx)
1502 msg_print("¼«Ê¬¤Î¤β¼¤Ë¤¢¤ëʪ¤Ï¼è¤ì¤Þ¤»¤ó¡£");
1504 msg_print("You can't fetch when you're already standing on something.");
1511 if (dir == 5 && target_okay())
1516 if (distance(py, px, ty, tx) > MAX_RANGE)
1519 msg_print("¤½¤ó¤Ê¤Ë±ó¤¯¤Ë¤¢¤ëʪ¤Ï¼è¤ì¤Þ¤»¤ó¡ª");
1521 msg_print("You can't fetch something that far away!");
1527 c_ptr = &cave[ty][tx];
1529 /* We need an item to fetch */
1533 msg_print("¤½¤³¤Ë¤Ï²¿¤â¤¢¤ê¤Þ¤»¤ó¡£");
1535 msg_print("There is no object at this place.");
1541 /* No fetching from vault */
1542 if (c_ptr->info & CAVE_ICKY)
1545 msg_print("¥¢¥¤¥Æ¥à¤¬¥³¥ó¥È¥í¡¼¥ë¤ò³°¤ì¤ÆÍî¤Á¤¿¡£");
1547 msg_print("The item slips from your control.");
1553 /* We need to see the item */
1554 if (require_los && !player_has_los_bold(ty, tx))
1557 msg_print("¤½¤³¤Ï¤¢¤Ê¤¿¤Î»ë³¦¤ËÆþ¤Ã¤Æ¤¤¤Þ¤»¤ó¡£");
1559 msg_print("You have no direct line of sight to that location.");
1567 /* Use a direction */
1568 ty = py; /* Where to drop the item */
1576 c_ptr = &cave[ty][tx];
1578 if ((distance(py, px, ty, tx) > MAX_RANGE) ||
1579 !cave_floor_bold(ty, tx)) return;
1581 while (!c_ptr->o_idx);
1584 o_ptr = &o_list[c_ptr->o_idx];
1586 if (o_ptr->weight > wgt)
1588 /* Too heavy to 'fetch' */
1590 msg_print("¤½¤Î¥¢¥¤¥Æ¥à¤Ï½Å²á¤®¤Þ¤¹¡£");
1592 msg_print("The object is too heavy.");
1599 c_ptr->o_idx = o_ptr->next_o_idx;
1600 cave[py][px].o_idx = i; /* 'move' it */
1601 o_ptr->next_o_idx = 0;
1602 o_ptr->iy = (byte)py;
1603 o_ptr->ix = (byte)px;
1605 object_desc(o_name, o_ptr, TRUE, 0);
1607 msg_format("%^s¤¬¤¢¤Ê¤¿¤Î¸µ¤ËÈô¤ó¤Ç¤¤¿¡£", o_name);
1609 msg_format("%^s flies through the air to your feet.", o_name);
1614 p_ptr->redraw |= PR_MAP;
1618 void alter_reality(void)
1620 if (!quest_number(dun_level) && dun_level)
1623 msg_print("À¤³¦¤¬ÊѤï¤Ã¤¿¡ª");
1625 msg_print("The world changes!");
1629 if (autosave_l) do_cmd_save_game(TRUE);
1632 p_ptr->leaving = TRUE;
1637 msg_print("À¤³¦¤¬¾¯¤·¤Î´ÖÊѲ½¤·¤¿¤è¤¦¤À¡£");
1639 msg_print("The world seems to change for a moment!");
1647 * Leave a "glyph of warding" which prevents monster movement
1649 bool warding_glyph(void)
1652 if (!cave_clean_bold(py, px))
1655 msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£");
1657 msg_print("The object resists the spell.");
1663 /* Create a glyph */
1664 cave_set_feat(py, px, FEAT_GLYPH);
1669 bool warding_mirror(void)
1672 if (!cave_clean_bold(py, px))
1675 msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£");
1677 msg_print("The object resists the spell.");
1683 /* Create a glyph */
1684 cave_set_feat(py, px, FEAT_MIRROR);
1693 * Leave an "explosive rune" which prevents monster movement
1695 bool explosive_rune(void)
1698 if (!cave_clean_bold(py, px))
1701 msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£");
1703 msg_print("The object resists the spell.");
1709 /* Create a glyph */
1710 cave_set_feat(py, px, FEAT_MINOR_GLYPH);
1717 * Identify everything being carried.
1718 * Done by a potion of "self knowledge".
1720 void identify_pack(void)
1724 /* Simply identify and know every item */
1725 for (i = 0; i < INVEN_TOTAL; i++)
1727 object_type *o_ptr = &inventory[i];
1729 /* Skip non-objects */
1730 if (!o_ptr->k_idx) continue;
1733 identify_item(o_ptr);
1739 * Used by the "enchant" function (chance of failure)
1740 * (modified for Zangband, we need better stuff there...) -- TY
1742 static int enchant_table[16] =
1744 0, 10, 50, 100, 200,
1745 300, 400, 500, 650, 800,
1746 950, 987, 993, 995, 998,
1752 * Removes curses from items in inventory
1754 * Note that Items which are "Perma-Cursed" (The One Ring,
1755 * The Crown of Morgoth) can NEVER be uncursed.
1757 * Note that if "all" is FALSE, then Items which are
1758 * "Heavy-Cursed" (Mormegil, Calris, and Weapons of Morgul)
1759 * will not be uncursed.
1761 static int remove_curse_aux(int all)
1765 /* Attempt to uncurse items being worn */
1766 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1770 object_type *o_ptr = &inventory[i];
1772 /* Skip non-objects */
1773 if (!o_ptr->k_idx) continue;
1775 /* Uncursed already */
1776 if (!cursed_p(o_ptr)) continue;
1778 /* Extract the flags */
1779 object_flags(o_ptr, &f1, &f2, &f3);
1781 /* Heavily Cursed Items need a special spell */
1782 if (!all && (f3 & TR3_HEAVY_CURSE)) continue;
1784 /* Perma-Cursed Items can NEVER be uncursed */
1785 if (f3 & TR3_PERMA_CURSE) continue;
1788 o_ptr->ident &= ~(IDENT_CURSED);
1790 /* Hack -- Assume felt */
1791 o_ptr->ident |= (IDENT_SENSE);
1793 if (o_ptr->art_flags3 & TR3_CURSED)
1794 o_ptr->art_flags3 &= ~(TR3_CURSED);
1796 if (o_ptr->art_flags3 & TR3_HEAVY_CURSE)
1797 o_ptr->art_flags3 &= ~(TR3_HEAVY_CURSE);
1800 o_ptr->feeling = FEEL_NONE;
1802 /* Recalculate the bonuses */
1803 p_ptr->update |= (PU_BONUS);
1806 p_ptr->window |= (PW_EQUIP);
1808 /* Count the uncursings */
1812 /* Return "something uncursed" */
1818 * Remove most curses
1820 bool remove_curse(void)
1822 return (remove_curse_aux(FALSE));
1828 bool remove_all_curse(void)
1830 return (remove_curse_aux(TRUE));
1835 * Turns an object into gold, gain some of its value in a shop
1844 char o_name[MAX_NLEN];
1845 char out_val[MAX_NLEN+40];
1849 /* Hack -- force destruction */
1850 if (command_arg > 0) force = TRUE;
1854 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò¶â¤ËÊѤ¨¤Þ¤¹¤«¡©";
1855 s = "¶â¤ËÊѤ¨¤é¤ì¤ëʪ¤¬¤¢¤ê¤Þ¤»¤ó¡£";
1857 q = "Turn which item to gold? ";
1858 s = "You have nothing to turn to gold.";
1861 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return (FALSE);
1863 /* Get the item (in the pack) */
1866 o_ptr = &inventory[item];
1869 /* Get the item (on the floor) */
1872 o_ptr = &o_list[0 - item];
1876 /* See how many items */
1877 if (o_ptr->number > 1)
1879 /* Get a quantity */
1880 amt = get_quantity(NULL, o_ptr->number);
1882 /* Allow user abort */
1883 if (amt <= 0) return FALSE;
1887 /* Describe the object */
1888 old_number = o_ptr->number;
1889 o_ptr->number = amt;
1890 object_desc(o_name, o_ptr, TRUE, 3);
1891 o_ptr->number = old_number;
1893 /* Verify unless quantity given */
1896 if (confirm_destroy || (object_value(o_ptr) > 0))
1898 /* Make a verification */
1900 sprintf(out_val, "ËÜÅö¤Ë%s¤ò¶â¤ËÊѤ¨¤Þ¤¹¤«¡©", o_name);
1902 sprintf(out_val, "Really turn %s to gold? ", o_name);
1905 if (!get_check(out_val)) return FALSE;
1909 /* Artifacts cannot be destroyed */
1910 if (artifact_p(o_ptr) || o_ptr->art_name)
1912 byte feel = FEEL_SPECIAL;
1916 msg_format("%s¤ò¶â¤ËÊѤ¨¤ë¤³¤È¤Ë¼ºÇÔ¤·¤¿¡£", o_name);
1918 msg_format("You fail to turn %s to gold!", o_name);
1922 /* Hack -- Handle icky artifacts */
1923 if (cursed_p(o_ptr) || broken_p(o_ptr)) feel = FEEL_TERRIBLE;
1925 /* Hack -- inscribe the artifact */
1926 o_ptr->feeling = feel;
1928 /* We have "felt" it (again) */
1929 o_ptr->ident |= (IDENT_SENSE);
1931 /* Combine the pack */
1932 p_ptr->notice |= (PN_COMBINE);
1935 p_ptr->window |= (PW_INVEN | PW_EQUIP);
1941 price = object_value_real(o_ptr);
1947 msg_format("%s¤ò¥Ë¥»¤Î¶â¤ËÊѤ¨¤¿¡£", o_name);
1949 msg_format("You turn %s to fool's gold.", o_name);
1957 if (amt > 1) price *= amt;
1959 if (price > 30000) price = 30000;
1961 msg_format("%s¤ò¡ð%d ¤Î¶â¤ËÊѤ¨¤¿¡£", o_name, price);
1963 msg_format("You turn %s to %ld coins worth of gold.", o_name, price);
1969 p_ptr->redraw |= (PR_GOLD);
1972 p_ptr->window |= (PW_PLAYER);
1976 /* Eliminate the item (from the pack) */
1979 inven_item_increase(item, -amt);
1980 inven_item_describe(item);
1981 inven_item_optimize(item);
1984 /* Eliminate the item (from the floor) */
1987 floor_item_increase(0 - item, -amt);
1988 floor_item_describe(0 - item);
1989 floor_item_optimize(0 - item);
1997 * Create stairs at the player location
1999 void stair_creation(void)
2002 if (!cave_valid_bold(py, px))
2005 msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£");
2007 msg_print("The object resists the spell.");
2014 delete_object(py, px);
2016 /* Create a staircase */
2017 if (p_ptr->inside_arena || (p_ptr->inside_quest && (p_ptr->inside_quest < MIN_RANDOM_QUEST)) || p_ptr->inside_battle || !dun_level)
2019 /* arena or quest */
2021 msg_print("¸ú²Ì¤¬¤¢¤ê¤Þ¤»¤ó¡ª");
2023 msg_print("There is no effect!");
2027 else if (ironman_downward)
2029 /* Town/wilderness or Ironman */
2030 cave_set_feat(py, px, FEAT_MORE);
2032 else if (quest_number(dun_level) || (dun_level >= d_info[dungeon_type].maxdepth))
2035 cave_set_feat(py, px, FEAT_LESS);
2037 else if (rand_int(100) < 50)
2039 cave_set_feat(py, px, FEAT_MORE);
2043 cave_set_feat(py, px, FEAT_LESS);
2049 * Hook to specify "weapon"
2051 bool item_tester_hook_weapon(object_type *o_ptr)
2053 switch (o_ptr->tval)
2067 if (o_ptr->sval != SV_DOKUBARI) return (TRUE);
2074 bool item_tester_hook_weapon2(object_type *o_ptr)
2076 switch (o_ptr->tval)
2096 * Hook to specify "armour"
2098 bool item_tester_hook_armour(object_type *o_ptr)
2100 switch (o_ptr->tval)
2120 bool item_tester_hook_corpse(object_type *o_ptr)
2122 switch (o_ptr->tval)
2135 * Check if an object is weapon or armour (but not arrow, bolt, or shot)
2137 bool item_tester_hook_weapon_armour(object_type *o_ptr)
2139 switch (o_ptr->tval)
2168 * Break the curse of an item
2170 static void break_curse(object_type *o_ptr)
2174 /* Extract the flags */
2175 object_flags(o_ptr, &f1, &f2, &f3);
2177 if (cursed_p(o_ptr) && !(f3 & TR3_PERMA_CURSE) && !(f3 & TR3_HEAVY_CURSE) && (rand_int(100) < 25))
2180 msg_print("¤«¤±¤é¤ì¤Æ¤¤¤¿¼ö¤¤¤¬ÂǤÁÇˤé¤ì¤¿¡ª");
2182 msg_print("The curse is broken!");
2186 o_ptr->ident &= ~(IDENT_CURSED);
2187 o_ptr->ident |= (IDENT_SENSE);
2189 if (o_ptr->art_flags3 & TR3_CURSED)
2190 o_ptr->art_flags3 &= ~(TR3_CURSED);
2192 o_ptr->feeling = FEEL_NONE;
2198 * Enchants a plus onto an item. -RAK-
2200 * Revamped! Now takes item pointer, number of times to try enchanting,
2201 * and a flag of what to try enchanting. Artifacts resist enchantment
2202 * some of the time, and successful enchantment to at least +0 might
2203 * break a curse on the item. -CFT-
2205 * Note that an item can technically be enchanted all the way to +15 if
2206 * you wait a very, very, long time. Going from +9 to +10 only works
2207 * about 5% of the time, and from +10 to +11 only about 1% of the time.
2209 * Note that this function can now be used on "piles" of items, and
2210 * the larger the pile, the lower the chance of success.
2212 bool enchant(object_type *o_ptr, int n, int eflag)
2214 int i, chance, prob;
2216 bool a = (artifact_p(o_ptr) || o_ptr->art_name);
2217 bool force = (eflag & ENCH_FORCE);
2220 /* Large piles resist enchantment */
2221 prob = o_ptr->number * 100;
2223 /* Missiles are easy to enchant */
2224 if ((o_ptr->tval == TV_BOLT) ||
2225 (o_ptr->tval == TV_ARROW) ||
2226 (o_ptr->tval == TV_SHOT))
2232 for (i = 0; i < n; i++)
2234 /* Hack -- Roll for pile resistance */
2235 if (!force && rand_int(prob) >= 100) continue;
2237 /* Enchant to hit */
2238 if (eflag & ENCH_TOHIT)
2240 if (o_ptr->to_h < 0) chance = 0;
2241 else if (o_ptr->to_h > 15) chance = 1000;
2242 else chance = enchant_table[o_ptr->to_h];
2244 if (force || ((randint(1000) > chance) && (!a || (rand_int(100) < 50))))
2249 /* only when you get it above -1 -CFT */
2250 if (o_ptr->to_h >= 0)
2255 /* Enchant to damage */
2256 if (eflag & ENCH_TODAM)
2258 if (o_ptr->to_d < 0) chance = 0;
2259 else if (o_ptr->to_d > 15) chance = 1000;
2260 else chance = enchant_table[o_ptr->to_d];
2262 if (force || ((randint(1000) > chance) && (!a || (rand_int(100) < 50))))
2267 /* only when you get it above -1 -CFT */
2268 if (o_ptr->to_d >= 0)
2273 /* Enchant to armor class */
2274 if (eflag & ENCH_TOAC)
2276 if (o_ptr->to_a < 0) chance = 0;
2277 else if (o_ptr->to_a > 15) chance = 1000;
2278 else chance = enchant_table[o_ptr->to_a];
2280 if (force || ((randint(1000) > chance) && (!a || (rand_int(100) < 50))))
2285 /* only when you get it above -1 -CFT */
2286 if (o_ptr->to_a >= 0)
2293 if (!res) return (FALSE);
2295 /* Recalculate bonuses */
2296 p_ptr->update |= (PU_BONUS);
2298 /* Combine / Reorder the pack (later) */
2299 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2302 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2313 * Enchant an item (in the inventory or on the floor)
2314 * Note that "num_ac" requires armour, else weapon
2315 * Returns TRUE if attempted, FALSE if cancelled
2317 bool enchant_spell(int num_hit, int num_dam, int num_ac)
2322 char o_name[MAX_NLEN];
2326 /* Assume enchant weapon */
2327 item_tester_hook = item_tester_hook_weapon;
2328 item_tester_no_ryoute = TRUE;
2330 /* Enchant armor if requested */
2331 if (num_ac) item_tester_hook = item_tester_hook_armour;
2335 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò¶¯²½¤·¤Þ¤¹¤«? ";
2336 s = "¶¯²½¤Ç¤¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2338 q = "Enchant which item? ";
2339 s = "You have nothing to enchant.";
2342 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2344 /* Get the item (in the pack) */
2347 o_ptr = &inventory[item];
2350 /* Get the item (on the floor) */
2353 o_ptr = &o_list[0 - item];
2358 object_desc(o_name, o_ptr, FALSE, 0);
2362 msg_format("%s ¤ÏÌÀ¤ë¤¯µ±¤¤¤¿¡ª",
2365 msg_format("%s %s glow%s brightly!",
2366 ((item >= 0) ? "Your" : "The"), o_name,
2367 ((o_ptr->number > 1) ? "" : "s"));
2372 if (enchant(o_ptr, num_hit, ENCH_TOHIT)) okay = TRUE;
2373 if (enchant(o_ptr, num_dam, ENCH_TODAM)) okay = TRUE;
2374 if (enchant(o_ptr, num_ac, ENCH_TOAC)) okay = TRUE;
2380 if (flush_failure) flush();
2384 msg_print("¶¯²½¤Ë¼ºÇÔ¤·¤¿¡£");
2386 msg_print("The enchantment failed.");
2389 if (randint(3)==1) chg_virtue(V_ENCHANT, -1);
2392 chg_virtue(V_ENCHANT, 1);
2396 /* Something happened */
2401 bool artifact_scroll(void)
2406 char o_name[MAX_NLEN];
2410 item_tester_no_ryoute = TRUE;
2411 /* Enchant weapon/armour */
2412 item_tester_hook = item_tester_hook_weapon_armour;
2416 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò¶¯²½¤·¤Þ¤¹¤«? ";
2417 s = "¶¯²½¤Ç¤¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2419 q = "Enchant which item? ";
2420 s = "You have nothing to enchant.";
2423 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2425 /* Get the item (in the pack) */
2428 o_ptr = &inventory[item];
2431 /* Get the item (on the floor) */
2434 o_ptr = &o_list[0 - item];
2439 object_desc(o_name, o_ptr, FALSE, 0);
2443 msg_format("%s ¤ÏâÁ¤¤¸÷¤òȯ¤·¤¿¡ª",o_name);
2445 msg_format("%s %s radiate%s a blinding light!",
2446 ((item >= 0) ? "Your" : "The"), o_name,
2447 ((o_ptr->number > 1) ? "" : "s"));
2450 if (o_ptr->name1 || o_ptr->art_name)
2453 msg_format("%s¤Ï´û¤ËÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Ç¤¹¡ª",
2456 msg_format("The %s %s already %s!",
2457 o_name, ((o_ptr->number > 1) ? "are" : "is"),
2458 ((o_ptr->number > 1) ? "artifacts" : "an artifact"));
2464 else if (o_ptr->name2)
2467 msg_format("%s¤Ï´û¤Ë̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à¤Ç¤¹¡ª",
2470 msg_format("The %s %s already %s!",
2471 o_name, ((o_ptr->number > 1) ? "are" : "is"),
2472 ((o_ptr->number > 1) ? "ego items" : "an ego item"));
2478 else if (o_ptr->xtra3)
2481 msg_format("%s¤Ï´û¤Ë¶¯²½¤µ¤ì¤Æ¤¤¤Þ¤¹¡ª",
2484 msg_format("The %s %s already %s!",
2485 o_name, ((o_ptr->number > 1) ? "are" : "is"),
2486 ((o_ptr->number > 1) ? "kaji items" : "an kaji item"));
2492 if (o_ptr->number > 1)
2495 msg_print("Ê£¿ô¤Î¥¢¥¤¥Æ¥à¤ËËâË¡¤ò¤«¤±¤ë¤À¤±¤Î¥¨¥Í¥ë¥®¡¼¤Ï¤¢¤ê¤Þ¤»¤ó¡ª");
2496 msg_format("%d ¸Ä¤Î%s¤¬²õ¤ì¤¿¡ª",(o_ptr->number)-1, o_name);
2498 msg_print("Not enough enough energy to enchant more than one object!");
2499 msg_format("%d of your %s %s destroyed!",(o_ptr->number)-1, o_name, (o_ptr->number>2?"were":"was"));
2504 inven_item_increase(item, 1-(o_ptr->number));
2508 floor_item_increase(0-item, 1-(o_ptr->number));
2511 okay = create_artifact(o_ptr, TRUE);
2518 if (flush_failure) flush();
2522 msg_print("¶¯²½¤Ë¼ºÇÔ¤·¤¿¡£");
2524 msg_print("The enchantment failed.");
2527 if (randint(3)==1) chg_virtue(V_ENCHANT, -1);
2530 chg_virtue(V_ENCHANT, 1);
2534 /* Something happened */
2540 * Identify an object
2542 void identify_item(object_type *o_ptr)
2544 bool motoart = TRUE;
2545 char o_name[MAX_NLEN];
2548 object_desc(o_name, o_ptr, TRUE, 3);
2550 if ((artifact_p(o_ptr) || o_ptr->art_name) && !(o_ptr->ident & IDENT_KNOWN))
2553 if (!(o_ptr->ident & (IDENT_MENTAL)))
2555 if ((o_ptr->art_name) || (artifact_p(o_ptr)) || one_in_(5))
2556 chg_virtue(V_KNOWLEDGE, 1);
2559 /* Identify it fully */
2560 object_aware(o_ptr);
2561 object_known(o_ptr);
2563 /* Recalculate bonuses */
2564 p_ptr->update |= (PU_BONUS);
2566 /* Combine / Reorder the pack (later) */
2567 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2570 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2572 strcpy(record_o_name, o_name);
2576 object_desc(o_name, o_ptr, TRUE, 0);
2578 if(record_fix_art && !motoart && artifact_p(o_ptr))
2579 do_cmd_write_nikki(NIKKI_ART, 0, o_name);
2580 if(record_rand_art && !motoart && o_ptr->art_name)
2581 do_cmd_write_nikki(NIKKI_ART, 0, o_name);
2585 bool item_tester_hook_identify(object_type *o_ptr)
2587 return (bool)!object_known_p(o_ptr);
2590 bool item_tester_hook_identify_weapon_armour(object_type *o_ptr)
2592 if (object_known_p(o_ptr))
2594 return item_tester_hook_weapon_armour(o_ptr);
2598 * Identify an object in the inventory (or on the floor)
2599 * This routine does *not* automatically combine objects.
2600 * Returns TRUE if something was identified, else FALSE.
2602 bool ident_spell(bool only_equip)
2606 char o_name[MAX_NLEN];
2609 item_tester_no_ryoute = TRUE;
2612 item_tester_hook = item_tester_hook_identify_weapon_armour;
2614 item_tester_hook = item_tester_hook_identify;
2616 if (!can_get_item())
2620 item_tester_hook = item_tester_hook_weapon_armour;
2624 item_tester_hook = NULL;
2630 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò´ÕÄꤷ¤Þ¤¹¤«? ";
2631 s = "´ÕÄꤹ¤ë¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2633 q = "Identify which item? ";
2634 s = "You have nothing to identify.";
2637 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2639 /* Get the item (in the pack) */
2642 o_ptr = &inventory[item];
2645 /* Get the item (on the floor) */
2648 o_ptr = &o_list[0 - item];
2652 identify_item(o_ptr);
2655 object_desc(o_name, o_ptr, TRUE, 3);
2658 if (item >= INVEN_RARM)
2661 msg_format("%^s: %s(%c)¡£",
2663 msg_format("%^s: %s (%c).",
2666 describe_use(item), o_name, index_to_label(item));
2671 msg_format("¥¶¥Ã¥¯Ãæ: %s(%c)¡£",
2673 msg_format("In your pack: %s (%c).",
2676 o_name, index_to_label(item));
2681 msg_format("¾²¾å: %s¡£",
2683 msg_format("On the ground: %s.",
2689 /* Something happened */
2695 * Mundanify an object in the inventory (or on the floor)
2696 * This routine does *not* automatically combine objects.
2697 * Returns TRUE if something was mundanified, else FALSE.
2699 bool mundane_spell(bool only_equip)
2705 if (only_equip) item_tester_hook = item_tester_hook_weapon_armour;
2706 item_tester_no_ryoute = TRUE;
2710 q = "¤É¤ì¤ò»È¤¤¤Þ¤¹¤«¡©";
2711 s = "»È¤¨¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
2713 q = "Use which item? ";
2714 s = "You have nothing you can use.";
2717 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2719 /* Get the item (in the pack) */
2722 o_ptr = &inventory[item];
2725 /* Get the item (on the floor) */
2728 o_ptr = &o_list[0 - item];
2733 msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
2735 msg_print("There is a bright flash of light!");
2738 byte iy = o_ptr->iy; /* Y-position on map, or zero */
2739 byte ix = o_ptr->ix; /* X-position on map, or zero */
2740 s16b next_o_idx= o_ptr->next_o_idx; /* Next object in stack (if any) */
2741 byte marked=o_ptr->marked; /* Object is marked */
2742 s16b weight = (o_ptr->number*o_ptr->weight);
2745 object_prep(o_ptr, o_ptr->k_idx);
2749 o_ptr->next_o_idx=next_o_idx;
2750 o_ptr->marked=marked;
2751 if (item >= 0) p_ptr->total_weight += (o_ptr->weight - weight);
2755 /* Something happened */
2761 bool item_tester_hook_identify_fully(object_type *o_ptr)
2763 return (bool)(!object_known_p(o_ptr) || !(o_ptr->ident & IDENT_MENTAL));
2766 bool item_tester_hook_identify_fully_weapon_armour(object_type *o_ptr)
2768 if (!item_tester_hook_identify_fully(o_ptr))
2770 return item_tester_hook_weapon_armour(o_ptr);
2774 * Fully "identify" an object in the inventory -BEN-
2775 * This routine returns TRUE if an item was identified.
2777 bool identify_fully(bool only_equip)
2781 char o_name[MAX_NLEN];
2784 item_tester_no_ryoute = TRUE;
2786 item_tester_hook = item_tester_hook_identify_fully_weapon_armour;
2788 item_tester_hook = item_tester_hook_identify_fully;
2790 if (!can_get_item())
2793 item_tester_hook = item_tester_hook_weapon_armour;
2795 item_tester_hook = NULL;
2800 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò´ÕÄꤷ¤Þ¤¹¤«? ";
2801 s = "´ÕÄꤹ¤ë¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2803 q = "Identify which item? ";
2804 s = "You have nothing to identify.";
2807 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2809 /* Get the item (in the pack) */
2812 o_ptr = &inventory[item];
2815 /* Get the item (on the floor) */
2818 o_ptr = &o_list[0 - item];
2822 identify_item(o_ptr);
2824 /* Mark the item as fully known */
2825 o_ptr->ident |= (IDENT_MENTAL);
2831 object_desc(o_name, o_ptr, TRUE, 3);
2834 if (item >= INVEN_RARM)
2837 msg_format("%^s: %s(%c)¡£",
2839 msg_format("%^s: %s (%c).",
2842 describe_use(item), o_name, index_to_label(item));
2847 msg_format("¥¶¥Ã¥¯Ãæ: %s(%c)¡£",
2849 msg_format("In your pack: %s (%c).",
2852 o_name, index_to_label(item));
2857 msg_format("¾²¾å: %s¡£",
2859 msg_format("On the ground: %s.",
2865 /* Describe it fully */
2866 (void)identify_fully_aux(o_ptr);
2876 * Hook for "get_item()". Determine if something is rechargable.
2878 bool item_tester_hook_recharge(object_type *o_ptr)
2880 /* Recharge staffs */
2881 if (o_ptr->tval == TV_STAFF) return (TRUE);
2883 /* Recharge wands */
2884 if (o_ptr->tval == TV_WAND) return (TRUE);
2886 /* Hack -- Recharge rods */
2887 if (o_ptr->tval == TV_ROD) return (TRUE);
2895 * Recharge a wand/staff/rod from the pack or on the floor.
2896 * This function has been rewritten in Oangband and ZAngband.
2898 * Sorcery/Arcane -- Recharge --> recharge(plev * 4)
2899 * Chaos -- Arcane Binding --> recharge(90)
2901 * Scroll of recharging --> recharge(130)
2902 * Artifact activation/Thingol --> recharge(130)
2904 * It is harder to recharge high level, and highly charged wands,
2905 * staffs, and rods. The more wands in a stack, the more easily and
2906 * strongly they recharge. Staffs, however, each get fewer charges if
2909 * XXX XXX XXX Beware of "sliding index errors".
2911 bool recharge(int power)
2914 int recharge_strength, recharge_amount;
2923 char o_name[MAX_NLEN];
2925 /* Only accept legal items */
2926 item_tester_hook = item_tester_hook_recharge;
2930 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ËËâÎϤò½¼Å¶¤·¤Þ¤¹¤«? ";
2931 s = "ËâÎϤò½¼Å¶¤¹¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2933 q = "Recharge which item? ";
2934 s = "You have nothing to recharge.";
2937 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return (FALSE);
2939 /* Get the item (in the pack) */
2942 o_ptr = &inventory[item];
2945 /* Get the item (on the floor) */
2948 o_ptr = &o_list[0 - item];
2951 /* Get the object kind. */
2952 k_ptr = &k_info[o_ptr->k_idx];
2954 /* Extract the object "level" */
2955 lev = get_object_level(o_ptr);
2958 /* Recharge a rod */
2959 if (o_ptr->tval == TV_ROD)
2961 /* Extract a recharge strength by comparing object level to power. */
2962 recharge_strength = ((power > lev/2) ? (power - lev/2) : 0) / 5;
2966 if (rand_int(recharge_strength) == 0)
2968 /* Activate the failure code. */
2975 /* Recharge amount */
2976 recharge_amount = (power * damroll(3, 2));
2978 /* Recharge by that amount */
2979 if (o_ptr->timeout > recharge_amount)
2980 o_ptr->timeout -= recharge_amount;
2987 /* Recharge wand/staff */
2990 /* Extract a recharge strength by comparing object level to power.
2991 * Divide up a stack of wands' charges to calculate charge penalty.
2993 if ((o_ptr->tval == TV_WAND) && (o_ptr->number > 1))
2994 recharge_strength = (100 + power - lev -
2995 (8 * o_ptr->pval / o_ptr->number)) / 15;
2997 /* All staffs, unstacked wands. */
2998 else recharge_strength = (100 + power - lev -
2999 (8 * o_ptr->pval)) / 15;
3002 if (recharge_strength < 0) recharge_strength = 0;
3005 if (rand_int(recharge_strength) == 0)
3007 /* Activate the failure code. */
3011 /* If the spell didn't backfire, recharge the wand or staff. */
3014 /* Recharge based on the standard number of charges. */
3015 recharge_amount = randint(1 + k_ptr->pval / 2);
3017 /* Multiple wands in a stack increase recharging somewhat. */
3018 if ((o_ptr->tval == TV_WAND) && (o_ptr->number > 1))
3021 (randint(recharge_amount * (o_ptr->number - 1))) / 2;
3022 if (recharge_amount < 1) recharge_amount = 1;
3023 if (recharge_amount > 12) recharge_amount = 12;
3026 /* But each staff in a stack gets fewer additional charges,
3027 * although always at least one.
3029 if ((o_ptr->tval == TV_STAFF) && (o_ptr->number > 1))
3031 recharge_amount /= o_ptr->number;
3032 if (recharge_amount < 1) recharge_amount = 1;
3035 /* Recharge the wand or staff. */
3036 o_ptr->pval += recharge_amount;
3039 /* Hack -- we no longer "know" the item */
3040 o_ptr->ident &= ~(IDENT_KNOWN);
3042 /* Hack -- we no longer think the item is empty */
3043 o_ptr->ident &= ~(IDENT_EMPTY);
3048 /* Inflict the penalties for failing a recharge. */
3051 /* Artifacts are never destroyed. */
3052 if (artifact_p(o_ptr))
3054 object_desc(o_name, o_ptr, TRUE, 0);
3056 msg_format("ËâÎϤ¬µÕή¤·¤¿¡ª%s¤Ï´°Á´¤ËËâÎϤò¼º¤Ã¤¿¡£", o_name);
3058 msg_format("The recharging backfires - %s is completely drained!", o_name);
3062 /* Artifact rods. */
3063 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout < 10000))
3064 o_ptr->timeout = (o_ptr->timeout + 100) * 2;
3066 /* Artifact wands and staffs. */
3067 else if ((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_STAFF))
3072 /* Get the object description */
3073 object_desc(o_name, o_ptr, FALSE, 0);
3075 /*** Determine Seriousness of Failure ***/
3077 /* Mages recharge objects more safely. */
3078 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)
3080 /* 10% chance to blow up one rod, otherwise draining. */
3081 if (o_ptr->tval == TV_ROD)
3083 if (randint(10) == 1) fail_type = 2;
3086 /* 75% chance to blow up one wand, otherwise draining. */
3087 else if (o_ptr->tval == TV_WAND)
3089 if (randint(3) != 1) fail_type = 2;
3092 /* 50% chance to blow up one staff, otherwise no effect. */
3093 else if (o_ptr->tval == TV_STAFF)
3095 if (randint(2) == 1) fail_type = 2;
3100 /* All other classes get no special favors. */
3103 /* 33% chance to blow up one rod, otherwise draining. */
3104 if (o_ptr->tval == TV_ROD)
3106 if (randint(3) == 1) fail_type = 2;
3109 /* 20% chance of the entire stack, else destroy one wand. */
3110 else if (o_ptr->tval == TV_WAND)
3112 if (randint(5) == 1) fail_type = 3;
3115 /* Blow up one staff. */
3116 else if (o_ptr->tval == TV_STAFF)
3122 /*** Apply draining and destruction. ***/
3124 /* Drain object or stack of objects. */
3127 if (o_ptr->tval == TV_ROD)
3130 msg_print("ËâÎϤ¬µÕÊ®¼Í¤·¤Æ¡¢¥í¥Ã¥É¤«¤é¤µ¤é¤ËËâÎϤòµÛ¤¤¼è¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
3132 msg_print("The recharge backfires, draining the rod further!");
3135 if (o_ptr->timeout < 10000)
3136 o_ptr->timeout = (o_ptr->timeout + 100) * 2;
3138 else if (o_ptr->tval == TV_WAND)
3141 msg_format("%s¤ÏÇË»¤òÌȤ줿¤¬¡¢ËâÎϤ¬Á´¤Æ¼º¤ï¤ì¤¿¡£", o_name);
3143 msg_format("You save your %s from destruction, but all charges are lost.", o_name);
3148 /* Staffs aren't drained. */
3151 /* Destroy an object or one in a stack of objects. */
3154 if (o_ptr->number > 1)
3156 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬°ìËܲõ¤ì¤¿¡ª", o_name);
3158 msg_format("Wild magic consumes one of your %s!", o_name);
3163 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²õ¤ì¤¿¡ª", o_name);
3165 msg_format("Wild magic consumes your %s!", o_name);
3169 /* Reduce rod stack maximum timeout, drain wands. */
3170 if (o_ptr->tval == TV_ROD) o_ptr->timeout = (o_ptr->number - 1) * k_ptr->pval;
3171 if (o_ptr->tval == TV_WAND) o_ptr->pval = 0;
3173 /* Reduce and describe inventory */
3176 inven_item_increase(item, -1);
3177 inven_item_describe(item);
3178 inven_item_optimize(item);
3181 /* Reduce and describe floor item */
3184 floor_item_increase(0 - item, -1);
3185 floor_item_describe(0 - item);
3186 floor_item_optimize(0 - item);
3190 /* Destroy all members of a stack of objects. */
3193 if (o_ptr->number > 1)
3195 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬Á´¤Æ²õ¤ì¤¿¡ª", o_name);
3197 msg_format("Wild magic consumes all your %s!", o_name);
3202 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²õ¤ì¤¿¡ª", o_name);
3204 msg_format("Wild magic consumes your %s!", o_name);
3209 /* Reduce and describe inventory */
3212 inven_item_increase(item, -999);
3213 inven_item_describe(item);
3214 inven_item_optimize(item);
3217 /* Reduce and describe floor item */
3220 floor_item_increase(0 - item, -999);
3221 floor_item_describe(0 - item);
3222 floor_item_optimize(0 - item);
3228 /* Combine / Reorder the pack (later) */
3229 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
3232 p_ptr->window |= (PW_INVEN);
3234 /* Something was done */
3242 bool bless_weapon(void)
3247 char o_name[MAX_NLEN];
3250 item_tester_no_ryoute = TRUE;
3251 /* Assume enchant weapon */
3252 item_tester_hook = item_tester_hook_weapon2;
3256 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò½ËÊ¡¤·¤Þ¤¹¤«¡©";
3257 s = "½ËÊ¡¤Ç¤¤ëÉð´ï¤¬¤¢¤ê¤Þ¤»¤ó¡£";
3259 q = "Bless which weapon? ";
3260 s = "You have weapon to bless.";
3263 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR)))
3266 /* Get the item (in the pack) */
3269 o_ptr = &inventory[item];
3272 /* Get the item (on the floor) */
3275 o_ptr = &o_list[0 - item];
3280 object_desc(o_name, o_ptr, FALSE, 0);
3282 /* Extract the flags */
3283 object_flags(o_ptr, &f1, &f2, &f3);
3285 if (o_ptr->ident & IDENT_CURSED)
3287 if (((f3 & TR3_HEAVY_CURSE) && (randint(100) < 33)) ||
3288 (f3 & TR3_PERMA_CURSE))
3291 msg_format("%s¤òʤ¤¦¹õ¤¤¥ª¡¼¥é¤Ï½ËÊ¡¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
3294 msg_format("The black aura on %s %s disrupts the blessing!",
3295 ((item >= 0) ? "your" : "the"), o_name);
3302 msg_format("%s ¤«¤é¼Ù°¤Ê¥ª¡¼¥é¤¬¾Ã¤¨¤¿¡£",
3305 msg_format("A malignant aura leaves %s %s.",
3306 ((item >= 0) ? "your" : "the"), o_name);
3311 o_ptr->ident &= ~(IDENT_CURSED);
3313 /* Hack -- Assume felt */
3314 o_ptr->ident |= (IDENT_SENSE);
3317 o_ptr->feeling = FEEL_NONE;
3319 /* Recalculate the bonuses */
3320 p_ptr->update |= (PU_BONUS);
3323 p_ptr->window |= (PW_EQUIP);
3327 * Next, we try to bless it. Artifacts have a 1/3 chance of
3328 * being blessed, otherwise, the operation simply disenchants
3329 * them, godly power negating the magic. Ok, the explanation
3330 * is silly, but otherwise priests would always bless every
3331 * artifact weapon they find. Ego weapons and normal weapons
3332 * can be blessed automatically.
3334 if (f3 & TR3_BLESSED)
3337 msg_format("%s ¤Ï´û¤Ë½ËÊ¡¤µ¤ì¤Æ¤¤¤ë¡£",
3340 msg_format("%s %s %s blessed already.",
3341 ((item >= 0) ? "Your" : "The"), o_name,
3342 ((o_ptr->number > 1) ? "were" : "was"));
3348 if (!(o_ptr->art_name || o_ptr->name1 || o_ptr->name2) || (randint(3) == 1))
3352 msg_format("%s¤Ïµ±¤¤¤¿¡ª",
3355 msg_format("%s %s shine%s!",
3356 ((item >= 0) ? "Your" : "The"), o_name,
3357 ((o_ptr->number > 1) ? "" : "s"));
3360 o_ptr->art_flags3 |= TR3_BLESSED;
3361 o_ptr->discount = 99;
3365 bool dis_happened = FALSE;
3368 msg_print("¤½¤ÎÉð´ï¤Ï½ËÊ¡¤ò·ù¤Ã¤Æ¤¤¤ë¡ª");
3370 msg_print("The weapon resists your blessing!");
3374 /* Disenchant tohit */
3375 if (o_ptr->to_h > 0)
3378 dis_happened = TRUE;
3381 if ((o_ptr->to_h > 5) && (rand_int(100) < 33)) o_ptr->to_h--;
3383 /* Disenchant todam */
3384 if (o_ptr->to_d > 0)
3387 dis_happened = TRUE;
3390 if ((o_ptr->to_d > 5) && (rand_int(100) < 33)) o_ptr->to_d--;
3392 /* Disenchant toac */
3393 if (o_ptr->to_a > 0)
3396 dis_happened = TRUE;
3399 if ((o_ptr->to_a > 5) && (rand_int(100) < 33)) o_ptr->to_a--;
3404 msg_print("¼þ°Ï¤¬ËÞÍǤÊÊ·°Ïµ¤¤ÇËþ¤Á¤¿...");
3406 msg_print("There is a static feeling in the air...");
3410 msg_format("%s ¤ÏÎô²½¤·¤¿¡ª",
3413 msg_format("%s %s %s disenchanted!",
3414 ((item >= 0) ? "Your" : "The"), o_name,
3415 ((o_ptr->number > 1) ? "were" : "was"));
3421 /* Recalculate bonuses */
3422 p_ptr->update |= (PU_BONUS);
3425 p_ptr->window |= (PW_EQUIP | PW_PLAYER);
3436 bool pulish_shield(void)
3441 char o_name[MAX_NLEN];
3444 item_tester_no_ryoute = TRUE;
3445 /* Assume enchant weapon */
3446 item_tester_tval = TV_SHIELD;
3450 q = "¤É¤Î½â¤òËᤤޤ¹¤«¡©";
3451 s = "Ë᤯½â¤¬¤¢¤ê¤Þ¤»¤ó¡£";
3453 q = "Pulish which weapon? ";
3454 s = "You have weapon to pulish.";
3457 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR)))
3460 /* Get the item (in the pack) */
3463 o_ptr = &inventory[item];
3466 /* Get the item (on the floor) */
3469 o_ptr = &o_list[0 - item];
3474 object_desc(o_name, o_ptr, FALSE, 0);
3476 /* Extract the flags */
3477 object_flags(o_ptr, &f1, &f2, &f3);
3479 if (o_ptr->k_idx && !artifact_p(o_ptr) && !ego_item_p(o_ptr) &&
3480 !o_ptr->art_name && !cursed_p(o_ptr) && (o_ptr->sval != SV_SHIELD_OF_DEFLECTION))
3483 msg_format("%s¤Ïµ±¤¤¤¿¡ª", o_name);
3485 msg_format("%s %s shine%s!",
3486 ((item >= 0) ? "Your" : "The"), o_name,
3487 ((o_ptr->number > 1) ? "" : "s"));
3489 o_ptr->name2 = EGO_REFLECTION;
3490 enchant(o_ptr, rand_int(3) + 4, ENCH_TOAC);
3492 o_ptr->discount = 99;
3493 chg_virtue(V_ENCHANT, 2);
3499 if (flush_failure) flush();
3502 msg_print("¼ºÇÔ¤·¤¿¡£");
3504 msg_print("Failed.");
3507 chg_virtue(V_ENCHANT, -2);
3516 * Potions "smash open" and cause an area effect when
3517 * (1) they are shattered while in the player's inventory,
3518 * due to cold (etc) attacks;
3519 * (2) they are thrown at a monster, or obstacle;
3520 * (3) they are shattered by a "cold ball" or other such spell
3521 * while lying on the floor.
3524 * who --- who caused the potion to shatter (0=player)
3525 * potions that smash on the floor are assumed to
3526 * be caused by no-one (who = 1), as are those that
3527 * shatter inside the player inventory.
3528 * (Not anymore -- I changed this; TY)
3529 * y, x --- coordinates of the potion (or player if
3530 * the potion was in her inventory);
3531 * o_ptr --- pointer to the potion object.
3533 bool potion_smash_effect(int who, int y, int x, int k_idx)
3541 object_kind *k_ptr = &k_info[k_idx];
3543 switch (k_ptr->sval)
3545 case SV_POTION_SALT_WATER:
3546 case SV_POTION_SLIME_MOLD:
3547 case SV_POTION_LOSE_MEMORIES:
3548 case SV_POTION_DEC_STR:
3549 case SV_POTION_DEC_INT:
3550 case SV_POTION_DEC_WIS:
3551 case SV_POTION_DEC_DEX:
3552 case SV_POTION_DEC_CON:
3553 case SV_POTION_DEC_CHR:
3554 case SV_POTION_WATER: /* perhaps a 'water' attack? */
3555 case SV_POTION_APPLE_JUICE:
3558 case SV_POTION_INFRAVISION:
3559 case SV_POTION_DETECT_INVIS:
3560 case SV_POTION_SLOW_POISON:
3561 case SV_POTION_CURE_POISON:
3562 case SV_POTION_BOLDNESS:
3563 case SV_POTION_RESIST_HEAT:
3564 case SV_POTION_RESIST_COLD:
3565 case SV_POTION_HEROISM:
3566 case SV_POTION_BESERK_STRENGTH:
3567 case SV_POTION_RES_STR:
3568 case SV_POTION_RES_INT:
3569 case SV_POTION_RES_WIS:
3570 case SV_POTION_RES_DEX:
3571 case SV_POTION_RES_CON:
3572 case SV_POTION_RES_CHR:
3573 case SV_POTION_INC_STR:
3574 case SV_POTION_INC_INT:
3575 case SV_POTION_INC_WIS:
3576 case SV_POTION_INC_DEX:
3577 case SV_POTION_INC_CON:
3578 case SV_POTION_INC_CHR:
3579 case SV_POTION_AUGMENTATION:
3580 case SV_POTION_ENLIGHTENMENT:
3581 case SV_POTION_STAR_ENLIGHTENMENT:
3582 case SV_POTION_SELF_KNOWLEDGE:
3583 case SV_POTION_EXPERIENCE:
3584 case SV_POTION_RESISTANCE:
3585 case SV_POTION_INVULNERABILITY:
3586 case SV_POTION_NEW_LIFE:
3587 /* All of the above potions have no effect when shattered */
3589 case SV_POTION_SLOWNESS:
3595 case SV_POTION_POISON:
3601 case SV_POTION_BLINDNESS:
3606 case SV_POTION_CONFUSION: /* Booze */
3611 case SV_POTION_SLEEP:
3616 case SV_POTION_RUINATION:
3617 case SV_POTION_DETONATIONS:
3619 dam = damroll(25, 25);
3623 case SV_POTION_DEATH:
3624 dt = GF_DEATH_RAY; /* !! */
3625 dam = k_ptr->level * 10;
3630 case SV_POTION_SPEED:
3634 case SV_POTION_CURE_LIGHT:
3636 dam = damroll(2, 3);
3639 case SV_POTION_CURE_SERIOUS:
3641 dam = damroll(4, 3);
3644 case SV_POTION_CURE_CRITICAL:
3645 case SV_POTION_CURING:
3647 dam = damroll(6, 3);
3650 case SV_POTION_HEALING:
3652 dam = damroll(10, 10);
3655 case SV_POTION_RESTORE_EXP:
3661 case SV_POTION_LIFE:
3663 dam = damroll(50, 50);
3667 case SV_POTION_STAR_HEALING:
3669 dam = damroll(50, 50);
3673 case SV_POTION_RESTORE_MANA: /* MANA */
3675 dam = damroll(10, 10);
3683 (void)project(who, radius, y, x, dam, dt,
3684 (PROJECT_JUMP | PROJECT_ITEM | PROJECT_KILL), -1);
3686 /* XXX those potions that explode need to become "known" */
3692 * Hack -- Display all known spells in a window
3694 * XXX XXX XXX Need to analyze size of the window.
3696 * XXX XXX XXX Need more color coding.
3698 void display_spell_list(void)
3702 int use_realm1 = p_ptr->realm1 - 1;
3703 int use_realm2 = p_ptr->realm2 - 1;
3713 /* Warriors are illiterate */
3714 if (!mp_ptr->spell_book) return;
3715 if (p_ptr->pclass == CLASS_SORCERER) return;
3716 if (p_ptr->pclass == CLASS_RED_MAGE) return;
3718 /* Mindcrafter spell-list */
3719 if ((p_ptr->pclass == CLASS_MINDCRAFTER) || (p_ptr->pclass == CLASS_FORCETRAINER))
3725 int plev = p_ptr->lev;
3732 /* Display a list of spells */
3735 put_str("̾Á°", y, x + 5);
3736 put_str("Lv MP ¼ºÎ¨ ¸ú²Ì", y, x + 35);
3738 put_str("Name", y, x + 5);
3739 put_str("Lv Mana Fail Info", y, x + 35);
3742 switch(p_ptr->pclass)
3744 case CLASS_MINDCRAFTER: use_mind = MIND_MINDCRAFTER;break;
3745 case CLASS_FORCETRAINER: use_mind = MIND_KI;break;
3746 default: use_mind = 0;break;
3749 /* Dump the spells */
3750 for (i = 0; i < MAX_MIND_POWERS; i++)
3752 byte a = TERM_WHITE;
3754 /* Access the available spell */
3755 spell = mind_powers[use_mind].info[i];
3756 if (spell.min_lev > plev) break;
3758 /* Get the failure rate */
3759 chance = spell.fail;
3761 /* Reduce failure rate by "effective" level adjustment */
3762 chance -= 3 * (p_ptr->lev - spell.min_lev);
3764 /* Reduce failure rate by INT/WIS adjustment */
3765 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
3767 /* Not enough mana to cast */
3768 if (spell.mana_cost > p_ptr->csp)
3770 chance += 5 * (spell.mana_cost - p_ptr->csp);
3774 /* Extract the minimum failure rate */
3775 minfail = adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]];
3777 /* Minimum failure rate */
3778 if (chance < minfail) chance = minfail;
3780 /* Stunning makes spells harder */
3781 if (p_ptr->stun > 50) chance += 25;
3782 else if (p_ptr->stun) chance += 15;
3784 /* Always a 5 percent chance of working */
3785 if (chance > 95) chance = 95;
3788 mindcraft_info(comment, use_mind, i);
3790 /* Dump the spell */
3791 sprintf(psi_desc, " %c) %-30s%2d %4d %3d%%%s",
3793 spell.min_lev, spell.mana_cost, chance, comment);
3795 Term_putstr(x, y + i + 1, -1, a, psi_desc);
3800 /* Normal spellcaster with books */
3803 for (j = 0; j < ((use_realm2 > -1) ? 2 : 1); j++)
3807 /* Reset vertical */
3810 /* Vertical location */
3811 y = (j < 3) ? 0 : (m[j - 3] + 2);
3813 /* Horizontal location */
3817 for (i = 0; i < 32; i++)
3819 byte a = TERM_WHITE;
3821 /* Access the spell */
3822 if (!is_magic((j < 1) ? use_realm1 : use_realm2))
3824 s_ptr = &technic_info[(j < 1) ? use_realm1 : use_realm2 - MIN_TECHNIC][i % 32];
3828 s_ptr = &mp_ptr->info[(j < 1) ? use_realm1 : use_realm2][i % 32];
3831 strcpy(name, spell_names[technic2magic((j < 1) ? use_realm1+1 : use_realm2+1)-1][i % 32]);
3834 if (s_ptr->slevel >= 99)
3838 strcpy(name, "(ȽÆÉÉÔǽ)");
3840 strcpy(name, "(illegible)");
3850 ((spell_forgotten1 & (1L << i))) :
3851 ((spell_forgotten2 & (1L << (i % 32)))))
3858 else if (!((j < 1) ?
3859 (spell_learned1 & (1L << i)) :
3860 (spell_learned2 & (1L << (i % 32)))))
3867 else if (!((j < 1) ?
3868 (spell_worked1 & (1L << i)) :
3869 (spell_worked2 & (1L << (i % 32)))))
3875 /* Dump the spell --(-- */
3876 sprintf(out_val, "%c/%c) %-20.20s",
3877 I2A(n / 8), I2A(n % 8), name);
3882 /* Dump onto the window */
3883 Term_putstr(x, m[j], -1, a, out_val);
3894 * Returns spell chance of failure for spell -RAK-
3896 s16b spell_chance(int spell, int realm)
3898 int chance, minfail;
3901 int penalty = (mp_ptr->spell_stat == A_WIS) ? 10 : 4;
3904 /* Paranoia -- must be literate */
3905 if (!mp_ptr->spell_book) return (100);
3907 if (realm+1 == REALM_HISSATSU) return 0;
3909 /* Access the spell */
3910 if (!is_magic(realm+1))
3912 s_ptr = &technic_info[realm - MIN_TECHNIC][spell];
3916 s_ptr = &mp_ptr->info[realm][spell];
3919 /* Extract the base spell failure rate */
3920 chance = s_ptr->sfail;
3922 /* Reduce failure rate by "effective" level adjustment */
3923 chance -= 3 * (p_ptr->lev - s_ptr->slevel);
3925 /* Reduce failure rate by INT/WIS adjustment */
3926 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
3929 chance += (MAX(r_info[m_list[p_ptr->riding].r_idx].level-skill_exp[GINOU_RIDING]/100-10,0));
3931 if (p_ptr->pclass == CLASS_SORCERER)
3932 shouhimana = s_ptr->smana*2200 + 2399;
3933 else if (p_ptr->pclass == CLASS_RED_MAGE)
3934 shouhimana = s_ptr->smana*2600 + 2399;
3935 else if ((realm+1 == p_ptr->realm1) || (realm+1 == p_ptr->realm2))
3936 shouhimana = (s_ptr->smana*(3800-spell_exp[((p_ptr->realm1 == realm+1) ? spell: spell+32)])+2399);
3937 else shouhimana = s_ptr->smana*3800;
3940 else shouhimana *= 4;
3942 if(shouhimana < 1) shouhimana = 1;
3944 /* Not enough mana to cast */
3945 if (shouhimana > p_ptr->csp)
3947 chance += 5 * (shouhimana - p_ptr->csp);
3950 if (p_ptr->pseikaku == SEIKAKU_NAMAKE) chance += 10;
3951 if (p_ptr->pseikaku == SEIKAKU_KIREMONO) chance -= 3;
3952 if ((p_ptr->pseikaku == SEIKAKU_GAMAN) || (p_ptr->pseikaku == SEIKAKU_CHIKARA)) chance++;
3953 if (((realm + 1) != p_ptr->realm1) && ((p_ptr->pclass == CLASS_MAGE) || (p_ptr->pclass == CLASS_PRIEST))) chance += 5;
3955 /* Extract the minimum failure rate */
3956 minfail = adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]];
3959 * Non mage/priest characters never get too good
3960 * (added high mage, mindcrafter)
3962 if (mp_ptr->spell_xtra & MAGIC_FAIL_5PERCENT)
3964 if (minfail < 5) minfail = 5;
3967 /* Hack -- Priest prayer penalty for "edged" weapons -DGK */
3968 if (((p_ptr->pclass == CLASS_PRIEST) || (p_ptr->pclass == CLASS_SORCERER)) && p_ptr->icky_wield[0]) chance += 25;
3969 if (((p_ptr->pclass == CLASS_PRIEST) || (p_ptr->pclass == CLASS_SORCERER)) && p_ptr->icky_wield[1]) chance += 25;
3971 if (p_ptr->heavy_spell) chance += 20;
3972 if(p_ptr->dec_mana && p_ptr->easy_spell) chance-=4;
3973 else if (p_ptr->easy_spell) chance-=3;
3974 else if (p_ptr->dec_mana) chance-=2;
3976 if ((realm+1 == REALM_NATURE) && ((p_ptr->align > 50) || (p_ptr->align < -50))) chance += penalty;
3977 if ((realm+1 == REALM_LIFE) && (p_ptr->align < -20)) chance += penalty;
3978 if (((realm+1 == REALM_DEATH) || (realm+1 == REALM_DAEMON)) && (p_ptr->align > 20)) chance += penalty;
3980 /* Minimum failure rate */
3981 if (chance < minfail) chance = minfail;
3983 /* Stunning makes spells harder */
3984 if (p_ptr->stun > 50) chance += 25;
3985 else if (p_ptr->stun) chance += 15;
3987 /* Always a 5 percent chance of working */
3988 if (chance > 95) chance = 95;
3990 if ((realm+1 == p_ptr->realm1) || (realm+1 == p_ptr->realm2))
3992 if(spell_exp[((p_ptr->realm1 == realm+1) ? spell: spell+32)]>1399) chance--;
3993 if(spell_exp[((p_ptr->realm1 == realm+1) ? spell: spell+32)]>1599) chance--;
3995 if(p_ptr->dec_mana) chance--;
3996 if (p_ptr->heavy_spell) chance += 5;
3998 chance = MAX(chance,0);
4000 /* Return the chance */
4007 * Determine if a spell is "okay" for the player to cast or study
4008 * The spell must be legible, not forgotten, and also, to cast,
4009 * it must be known, and to study, it must not be known.
4011 bool spell_okay(int spell, bool learned, bool study_pray, int realm)
4015 /* Access the spell */
4016 if (!is_magic(realm+1))
4018 s_ptr = &technic_info[realm - MIN_TECHNIC][spell];
4022 s_ptr = &mp_ptr->info[realm][spell];
4025 /* Spell is illegal */
4026 if (s_ptr->slevel > p_ptr->lev) return (FALSE);
4028 /* Spell is forgotten */
4029 if ((realm == p_ptr->realm2 - 1) ?
4030 (spell_forgotten2 & (1L << spell)) :
4031 (spell_forgotten1 & (1L << spell)))
4037 if (p_ptr->pclass == CLASS_SORCERER) return (TRUE);
4038 if (p_ptr->pclass == CLASS_RED_MAGE) return (TRUE);
4040 /* Spell is learned */
4041 if ((realm == p_ptr->realm2 - 1) ?
4042 (spell_learned2 & (1L << spell)) :
4043 (spell_learned1 & (1L << spell)))
4046 return (!study_pray);
4049 /* Okay to study, not to cast */
4056 * Extra information on a spell -DRS-
4058 * We can use up to 14 characters of the buffer 'p'
4060 * The strings in this function were extracted from the code in the
4061 * functions "do_cmd_cast()" and "do_cmd_pray()" and may be dated.
4063 static void spell_info(char *p, int spell, int realm)
4065 int plev = p_ptr->lev;
4068 int orb = plev + (plev / ((p_ptr->pclass == CLASS_PRIEST ||
4069 p_ptr->pclass == CLASS_HIGH_MAGE ||
4070 p_ptr->pclass == CLASS_SORCERER) ? 2 : 4));
4072 int burst = plev + (plev / ((p_ptr->pclass == CLASS_MAGE ||
4073 p_ptr->pclass == CLASS_HIGH_MAGE ||
4074 p_ptr->pclass == CLASS_SORCERER) ? 2 : 4));
4076 cptr s_dam = "»½ý:";
4077 cptr s_dur = "´ü´Ö:";
4078 cptr s_range = "ÈÏ°Ï:";
4079 cptr s_heal = "²óÉü:";
4080 cptr s_random = "¥é¥ó¥À¥à";
4081 cptr s_delay = "ÃÙ±ä:";
4083 cptr s_dam = "dam ";
4084 cptr s_dur = "dur ";
4085 cptr s_range = "range ";
4086 cptr s_heal = "heal ";
4087 cptr s_random = "random";
4088 cptr s_delay = "delay ";
4093 /* Analyze the spell */
4099 case 1: sprintf(p, " %s2d10", s_heal); break;
4100 case 2: sprintf(p, " %s12+d12", s_dur); break;
4101 case 4: sprintf(p, " %s%d", s_dam, 10 + (plev / 2)); break;
4102 case 6: sprintf(p, " %s4d10", s_heal); break;
4103 case 10: sprintf(p, " %s8d10", s_heal); break;
4104 case 11: sprintf(p, " %s24+d24", s_dur); break;
4105 case 12: sprintf(p, " %s3d6+%d", s_dam, orb); break;
4106 case 13: sprintf(p, " %sd25+%d", s_dur, 3 * plev); break;
4107 case 14: sprintf(p, " %s300", s_heal); break;
4108 case 16: sprintf(p, " %sd%d", s_dam, plev); break;
4109 case 18: sprintf(p, " %sd%d", s_dam, 3 * plev); break;
4110 case 20: sprintf(p, " %sd%d", s_dam, 4 * plev); break;
4112 case 22: sprintf(p, " »:d%d/²ó:1000", 4 * plev); break;
4114 case 22: sprintf(p, " d %d/h 1000", 4 * plev); break;
4116 case 24: sprintf(p, " %s25+d25", s_dur); break;
4117 case 25: sprintf(p, " %s48+d48", s_dur); break;
4118 case 28: sprintf(p, " %s2000", s_heal); break;
4120 case 30: sprintf(p, " ²ó300/»%d+250", plev * 4); break;
4122 case 30: sprintf(p, " h300/d%d+250", plev * 4); break;
4124 case 31: sprintf(p, " %s%d+d%d", s_dur,(plev/2), (plev/2)); break;
4128 case 1: /* Sorcery */
4131 case 1: sprintf(p, " %s10", s_range); break;
4132 case 3: sprintf(p, " %s%d", s_dam, 10 + (plev / 2)); break;
4133 case 5: sprintf(p, " %s%d", s_range, plev * 5); break;
4134 case 13: sprintf(p, " %s%d+d%d", s_dur, plev, plev + 20); break;
4135 case 18: sprintf(p, " %s25+d30", s_dur); break;
4136 case 22: sprintf(p, " %s15+d21", s_delay); break;
4137 case 23: sprintf(p, " %s%d", s_range, plev / 2 + 10); break;
4138 case 25: sprintf(p, " %s7d7+%d", s_dam, plev); break;
4140 case 26: sprintf(p, " ºÇÂç½ÅÎÌ:%d.%dkg", lbtokg1(plev * 15),lbtokg2(plev * 15)); break;
4142 case 26: sprintf(p, " max wgt %d", plev * 15 / 10); break;
4144 case 27: sprintf(p, " %s25+d30", s_dur); break;
4145 case 31: sprintf(p, " %s4+d4", s_dur); break;
4149 case 2: /* Nature */
4153 case 1: sprintf(p, " %s%dd4 ¼ÍÄø%d", s_dam, (3 + ((plev - 1) / 5)), plev/6+2); break;
4155 case 1: sprintf(p, " %s%dd4 rng %d", s_dam, (3 + ((plev - 1) / 5)), plev/6+2); break;
4157 case 4: sprintf(p, " %s%d", s_dam, 10 + (plev / 2)); break;
4158 case 6: sprintf(p, " %s20+d20", s_dur); break;
4159 case 7: sprintf(p, " %s2d8", s_heal); break;
4160 case 9: sprintf(p, " %s%dd8", s_dam, (3 + ((plev - 5) / 4))); break;
4161 case 11: sprintf(p, " %s%dd8", s_dam, (5 + ((plev - 5) / 4))); break;
4162 case 12: sprintf(p, " %s6d8", s_dam); break;
4163 case 15: sprintf(p, " %s500", s_heal); break;
4164 case 17: sprintf(p, " %s20+d30", s_dur); break;
4165 case 18: sprintf(p, " %s20+d20", s_dur); break;
4167 case 24: sprintf(p, " Ⱦ·Â:10"); break;
4169 case 24: sprintf(p, " rad 10"); break;
4171 case 26: sprintf(p, " %s%d", s_dam, 70 + plev * 3 / 2); break;
4172 case 27: sprintf(p, " %s%d", s_dam, 90 + plev * 3 / 2); break;
4173 case 28: sprintf(p, " %s%d", s_dam, 100 + plev * 3 / 2); break;
4174 case 29: sprintf(p, " %s75", s_dam); break;
4175 case 31: sprintf(p, " %s%d+%d", s_dam, 4 * plev, 100 + plev); break;
4182 case 0: sprintf(p, " %s%dd4", s_dam, 3 + ((plev - 1) / 5)); break;
4183 case 2: sprintf(p, " %s%d", s_dam, 10 + (plev / 2)); break;
4184 case 4: sprintf(p, " %s3d5+%d", s_dam, burst); break;
4185 case 5: sprintf(p, " %s%dd8", s_dam, (6 + ((plev - 5) / 4))); break;
4186 case 6: sprintf(p, " %s%dd8", s_dam, (8 + ((plev - 5) / 4))); break;
4187 case 7: sprintf(p, " %s%d", s_range, plev * 5); break;
4188 case 8: sprintf(p, " %s", s_random); break;
4189 case 9: sprintf(p, " %s%dd8", s_dam, (10 + ((plev - 5) / 4))); break;
4190 case 10: sprintf(p, " %s%d", s_dam, (60 + plev)/2); break;
4191 case 11: sprintf(p, " %s%dd8", s_dam, (11 + ((plev - 5) / 4))); break;
4192 case 12: sprintf(p, " %s%d", s_dam, 55 + plev); break;
4193 case 15: sprintf(p, " %s%d", s_dam, 99 + plev*2); break;
4194 case 17: sprintf(p, " %s%dd8", s_dam, (5 + (plev / 10))); break;
4195 case 19: sprintf(p, " %s%d", s_dam, 70 + plev); break;
4196 case 21: sprintf(p, " %s%d", s_dam, 120 + plev*2); break;
4197 case 24: sprintf(p, " %s%dd8", s_dam, (9 + (plev / 10))); break;
4199 case 25: sprintf(p, " %s³Æ%d", s_dam, plev * 2); break;
4201 case 25: sprintf(p, " dam %d each", plev * 2); break;
4203 case 26: sprintf(p, " %s%d", s_dam, 150 + plev*3/2); break;
4204 case 27: sprintf(p, " %s150 / 250", s_dam); break;
4205 case 29: sprintf(p, " %s%d", s_dam, 300 + (plev * 4)); break;
4206 case 30: sprintf(p, " %s%d", s_dam, p_ptr->chp); break;
4207 case 31: sprintf(p, " %s3 * 175", s_dam); break;
4214 case 1: sprintf(p, " %s%dd3", s_dam, (3 + ((plev - 1) / 5))); break;
4215 case 3: sprintf(p, " %s%d", s_dam, 10 + (plev / 2)); break;
4216 case 5: sprintf(p, " %s20+d20", s_dur); break;
4217 case 8: sprintf(p, " %s3d6+%d", s_dam, burst); break;
4218 case 9: sprintf(p, " %s%dd8", s_dam, (8 + ((plev - 5) / 4))); break;
4219 case 10: sprintf(p, " %s%d", s_dam, 30+plev); break;
4221 case 13: sprintf(p, " »:%d+d%d", plev * 2, plev * 2); break;
4223 case 13: sprintf(p, " d %d+d%d", plev * 2, plev * 2); break;
4225 case 16: sprintf(p, " %s25+d25", s_dur); break;
4226 case 17: sprintf(p, " %s", s_random); break;
4227 case 18: sprintf(p, " %s%dd8", s_dam, (4 + ((plev - 5) / 4))); break;
4228 case 19: sprintf(p, " %s25+d25", s_dur); break;
4229 case 21: sprintf(p, " %s3*100", s_dam); break;
4230 case 22: sprintf(p, " %sd%d", s_dam, plev * 3); break;
4231 case 23: sprintf(p, " %s%d", s_dam, 100 + plev * 2); break;
4232 case 27: sprintf(p, " %s%d+d%d", s_dur,10+plev/2, 10+plev/2); break;
4233 case 30: sprintf(p, " %s666", s_dam); break;
4234 case 31: sprintf(p, " %s%d+d%d", s_dur, (plev / 2), (plev / 2)); break;
4241 case 0: sprintf(p, " %s10", s_range); break;
4242 case 2: sprintf(p, " %s", s_random); break;
4243 case 4: sprintf(p, " %s%d", s_range, plev * 4); break;
4244 case 5: sprintf(p, " %s25+d30", s_dur); break;
4246 case 8: sprintf(p, " ºÇÂç½ÅÎÌ:%d.%d", lbtokg1(plev * 15 / 10),lbtokg2(plev * 15 / 10)); break;
4248 case 8: sprintf(p, " max wgt %d", plev * 15 / 10); break;
4250 case 13: sprintf(p, " %s%d", s_range, plev / 2 + 10); break;
4251 case 14: sprintf(p, " %s15+d21", s_delay); break;
4252 case 26: sprintf(p, " %s%d", s_heal, plev * 10 + 200); break;
4254 case 28: sprintf(p, " %s³Æ%d", s_dam, plev * 2); break;
4256 case 28: sprintf(p, " dam %d each", plev * 2); break;
4261 case 6: /* Arcane */
4264 case 0: sprintf(p, " %s%dd3", s_dam, 3 + ((plev - 1) / 5)); break;
4265 case 4: sprintf(p, " %s10", s_range); break;
4266 case 5: sprintf(p, " %s2d%d", s_dam, plev / 2); break;
4267 case 7: sprintf(p, " %s2d8", s_heal); break;
4271 case 17: sprintf(p, " %s20+d20", s_dur); break;
4272 case 18: sprintf(p, " %s4d8", s_heal); break;
4273 case 19: sprintf(p, " %s%d", s_range, plev * 5); break;
4274 case 21: sprintf(p, " %s6d8", s_dam); break;
4275 case 24: sprintf(p, " %s24+d24", s_dur); break;
4276 case 28: sprintf(p, " %s%d", s_dam, 75 + plev); break;
4277 case 30: sprintf(p, " %s15+d21", s_delay); break;
4278 case 31: sprintf(p, " %s25+d30", s_dur); break;
4285 case 0: sprintf(p, " %s100+d100", s_dur); break;
4286 case 1: sprintf(p, " %s80+d80", s_dur); break;
4292 case 18: sprintf(p, " %s20+d20", s_dur); break;
4293 case 5: sprintf(p, " %s25+d25", s_dur); break;
4294 case 8: sprintf(p, " %s24+d24", s_dur); break;
4295 case 11: sprintf(p, " %s25+d25", s_dur); break;
4296 case 13: sprintf(p, " %s%d+d25", s_dur, plev * 3); break;
4297 case 15: sprintf(p, " %s%d+d%d", s_dur, plev/2, plev/2); break;
4298 case 16: sprintf(p, " %s25+d30", s_dur); break;
4299 case 17: sprintf(p, " %s30+d20", s_dur); break;
4300 case 19: sprintf(p, " %s%d+d%d", s_dur, plev+20, plev); break;
4301 case 20: sprintf(p, " %s50+d50", s_dur); break;
4302 case 23: sprintf(p, " %s20+d20", s_dur); break;
4303 case 31: sprintf(p, " %s13+d13", s_dur); break;
4307 case 8: /* Daemon */
4310 case 0: sprintf(p, " %s%dd4", s_dam, 3 + ((plev - 1) / 5)); break;
4311 case 2: sprintf(p, " %s12+d12", s_dur); break;
4312 case 3: sprintf(p, " %s20+d20", s_dur); break;
4313 case 5: sprintf(p, " %s%dd8", s_dam, (6 + ((plev - 5) / 4))); break;
4314 case 7: sprintf(p, " %s3d6+%d", s_dam, burst); break;
4315 case 10: sprintf(p, " %s20+d20", s_dur); break;
4316 case 11: sprintf(p, " %s%dd8", s_dam, (11 + ((plev - 5) / 4))); break;
4317 case 12: sprintf(p, " %s%d", s_dam, 55 + plev); break;
4318 case 14: sprintf(p, " %s%d", s_dam, 100 + plev*3/2); break;
4319 case 16: sprintf(p, " %s30+d25", s_dur); break;
4320 case 17: sprintf(p, " %s20+d20", s_dur); break;
4321 case 18: sprintf(p, " %s%d", s_dam, 55 + plev); break;
4322 case 19: sprintf(p, " %s%d", s_dam, 80 + plev*3/2); break;
4323 case 20: sprintf(p, " %s%d+d%d", s_dur,10+plev/2, 10+plev/2); break;
4324 case 21: sprintf(p, " %sd%d+d%d", s_dam, 2 * plev, 2 * plev); break;
4325 case 22: sprintf(p, " %s%d", s_dam, 100 + plev*2); break;
4326 case 24: sprintf(p, " %s25+d25", s_dur); break;
4327 case 25: sprintf(p, " %s20+d20", s_dur); break;
4328 case 26: sprintf(p, " %s%d+%d", s_dam, 25+plev/2, 25+plev/2); break;
4329 case 29: sprintf(p, " %s%d", s_dam, plev*15); break;
4330 case 30: sprintf(p, " %s600", s_dam); break;
4331 case 31: sprintf(p, " %s15+d15", s_dur); break;
4335 case 15: /* Music */
4338 case 2 : sprintf(p, " %s%dd4", s_dam, 4 + ((plev - 1) / 5)); break;
4339 case 4 : sprintf(p, " %s2d6", s_heal); break;
4340 case 9 : sprintf(p, " %sd%d", s_dam, plev * 3 / 2); break;
4341 case 13: sprintf(p, " %s%dd7", s_dam, 10 + (plev / 5)); break;
4342 case 20: sprintf(p, " %sd%d+d%d", s_dam, plev * 3, plev * 3); break;
4343 case 22: sprintf(p, " %s%dd10", s_dam, 15 + ((plev - 1) / 2)); break;
4344 case 27: sprintf(p, " %sd%d", s_dam, plev * 3); break;
4345 case 28: sprintf(p, " %s15d10", s_heal); break;
4346 case 30: sprintf(p, " %s%dd10", s_dam, 50 + plev); break;
4351 sprintf(p, "̤ÃΤΥ¿¥¤¥×: %d", realm);
4353 sprintf(p, "Unknown type: %d.", realm);
4360 * Print a list of spells (for browsing or casting or viewing)
4362 void print_spells(int target_spell, byte *spells, int num, int y, int x, int realm)
4364 int i, spell, shougou, increment = 64;
4376 if (((realm < 0) || (realm > MAX_REALM - 1)) && wizard)
4378 msg_print("·Ù¹ð¡ª print_spell ¤¬Îΰè¤Ê¤·¤Ë¸Æ¤Ð¤ì¤¿");
4380 msg_print("Warning! print_spells called with null realm");
4384 /* Title the list */
4386 if (realm+1 == REALM_HISSATSU)
4388 strcpy(buf," Lv MP");
4390 strcpy(buf," Lv SP");
4394 strcpy(buf,"½ÏÎýÅÙ Lv MP ¼ºÎ¨ ¸ú²Ì");
4396 strcpy(buf,"Profic Lv SP Fail Effect");
4400 put_str("̾Á°", y, x + 5);
4401 put_str(buf, y, x + 29);
4403 put_str("Name", y, x + 5);
4404 put_str(buf, y, x + 29);
4407 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE)) increment = 0;
4408 else if ((realm + 1) == p_ptr->realm1) increment = 0;
4409 else if ((realm + 1) == p_ptr->realm2) increment = 32;
4411 /* Dump the spells */
4412 for (i = 0; i < num; i++)
4414 /* Access the spell */
4417 /* Access the spell */
4418 if (!is_magic(realm+1))
4420 s_ptr = &technic_info[realm - MIN_TECHNIC][spell];
4424 s_ptr = &mp_ptr->info[realm][spell];
4427 if (realm+1 == REALM_HISSATSU)
4428 shouhimana = s_ptr->smana;
4431 if (p_ptr->pclass == CLASS_SORCERER)
4432 shouhimana = s_ptr->smana*2200 + 2399;
4433 else if (p_ptr->pclass == CLASS_RED_MAGE)
4434 shouhimana = s_ptr->smana*2600 + 2399;
4435 else if ((realm+1 == p_ptr->realm1) || (realm+1 == p_ptr->realm2))
4436 shouhimana = (s_ptr->smana*(3800-spell_exp[(spell+increment)])+2399);
4438 shouhimana = s_ptr->smana*3800+2399;
4441 else shouhimana *= 4;
4443 if(shouhimana < 1) shouhimana = 1;
4446 if ((increment == 64) || (s_ptr->slevel >= 99)) shougou = 0;
4447 else if (spell_exp[spell+increment]<900) shougou = 0;
4448 else if (spell_exp[spell+increment]<1200) shougou = 1;
4449 else if (spell_exp[spell+increment]<1400) shougou = 2;
4450 else if (spell_exp[spell+increment]<1600) shougou = 3;
4453 if (!increment && (shougou == 4)) max = TRUE;
4454 else if ((increment == 32) && (shougou == 3)) max = TRUE;
4455 else if (s_ptr->slevel >= 99) max = TRUE;
4456 else if (p_ptr->pclass == CLASS_RED_MAGE) max = TRUE;
4458 strncpy(ryakuji,shougou_moji[shougou],4);
4462 if (use_menu && target_spell)
4464 if (i == (target_spell-1))
4466 strcpy(out_val, " ¡Õ ");
4468 strcpy(out_val, " > ");
4471 strcpy(out_val, " ");
4473 else sprintf(out_val, " %c) ", I2A(i));
4474 /* Skip illegible spells */
4475 if (s_ptr->slevel >= 99)
4478 strcat(out_val, format("%-30s", "(ȽÆÉÉÔǽ)"));
4480 strcat(out_val, format("%-30s", "(illegible)"));
4483 c_prt(TERM_L_DARK, out_val, y + i + 1, x);
4487 /* XXX XXX Could label spells above the players level */
4489 /* Get extra info */
4490 spell_info(info, spell, realm);
4495 /* Assume spell is known and tried */
4496 line_attr = TERM_WHITE;
4498 /* Analyze the spell */
4499 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4501 if (s_ptr->slevel > p_ptr->max_plv)
4506 comment = " unknown";
4509 line_attr = TERM_L_BLUE;
4511 else if (s_ptr->slevel > p_ptr->lev)
4516 comment = " forgotten";
4519 line_attr = TERM_YELLOW;
4522 else if ((realm+1 != p_ptr->realm1) && (realm+1 != p_ptr->realm2))
4527 comment = " unknown";
4530 line_attr = TERM_L_BLUE;
4532 else if ((realm + 1 == p_ptr->realm1) ?
4533 ((spell_forgotten1 & (1L << spell))) :
4534 ((spell_forgotten2 & (1L << spell))))
4539 comment = " forgotten";
4542 line_attr = TERM_YELLOW;
4544 else if (!((realm + 1 == p_ptr->realm1) ?
4545 (spell_learned1 & (1L << spell)) :
4546 (spell_learned2 & (1L << spell))))
4551 comment = " unknown";
4554 line_attr = TERM_L_BLUE;
4556 else if (!((realm + 1 == p_ptr->realm1) ?
4557 (spell_worked1 & (1L << spell)) :
4558 (spell_worked2 & (1L << spell))))
4561 comment = " ̤·Ð¸³";
4563 comment = " untried";
4566 line_attr = TERM_L_GREEN;
4569 /* Dump the spell --(-- */
4570 if (realm+1 == REALM_HISSATSU)
4572 strcat(out_val, format("%-25s %2d %4d",
4573 spell_names[technic2magic(realm+1)-1][spell], /* realm, spell */
4574 s_ptr->slevel, shouhimana));
4578 strcat(out_val, format("%-25s%c%-4s %2d %4d %3d%%%s",
4579 spell_names[technic2magic(realm+1)-1][spell], /* realm, spell */
4580 (max ? '!' : ' '), ryakuji,
4581 s_ptr->slevel, shouhimana, spell_chance(spell, realm), comment));
4583 c_prt(line_attr, out_val, y + i + 1, x);
4586 /* Clear the bottom line */
4587 prt("", y + i + 1, x);
4592 * Note that amulets, rods, and high-level spell books are immune
4593 * to "inventory damage" of any kind. Also sling ammo and shovels.
4598 * Does a given class of objects (usually) hate acid?
4599 * Note that acid can either melt or corrode something.
4601 bool hates_acid(object_type *o_ptr)
4603 /* Analyze the type */
4604 switch (o_ptr->tval)
4606 /* Wearable items */
4626 /* Staffs/Scrolls are wood/paper */
4639 /* Junk is useless */
4653 * Does a given object (usually) hate electricity?
4655 bool hates_elec(object_type *o_ptr)
4657 switch (o_ptr->tval)
4671 * Does a given object (usually) hate fire?
4672 * Hafted/Polearm weapons have wooden shafts.
4673 * Arrows/Bows are mostly wooden.
4675 bool hates_fire(object_type *o_ptr)
4677 /* Analyze the type */
4678 switch (o_ptr->tval)
4696 case TV_SORCERY_BOOK:
4697 case TV_NATURE_BOOK:
4701 case TV_ARCANE_BOOK:
4702 case TV_ENCHANT_BOOK:
4703 case TV_DAEMON_BOOK:
4705 case TV_HISSATSU_BOOK:
4716 /* Staffs/Scrolls burn */
4729 * Does a given object (usually) hate cold?
4731 bool hates_cold(object_type *o_ptr)
4733 switch (o_ptr->tval)
4750 int set_acid_destroy(object_type *o_ptr)
4753 if (!hates_acid(o_ptr)) return (FALSE);
4754 object_flags(o_ptr, &f1, &f2, &f3);
4755 if (f3 & TR3_IGNORE_ACID) return (FALSE);
4763 int set_elec_destroy(object_type *o_ptr)
4766 if (!hates_elec(o_ptr)) return (FALSE);
4767 object_flags(o_ptr, &f1, &f2, &f3);
4768 if (f3 & TR3_IGNORE_ELEC) return (FALSE);
4776 int set_fire_destroy(object_type *o_ptr)
4779 if (!hates_fire(o_ptr)) return (FALSE);
4780 object_flags(o_ptr, &f1, &f2, &f3);
4781 if (f3 & TR3_IGNORE_FIRE) return (FALSE);
4789 int set_cold_destroy(object_type *o_ptr)
4792 if (!hates_cold(o_ptr)) return (FALSE);
4793 object_flags(o_ptr, &f1, &f2, &f3);
4794 if (f3 & TR3_IGNORE_COLD) return (FALSE);
4800 * Destroys a type of item on a given percent chance
4801 * Note that missiles are no longer necessarily all destroyed
4802 * Destruction taken from "melee.c" code for "stealing".
4803 * New-style wands and rods handled correctly. -LM-
4804 * Returns number of items destroyed.
4806 int inven_damage(inven_func typ, int perc)
4810 char o_name[MAX_NLEN];
4812 /* Multishadow effects is determined by turn */
4813 if( p_ptr->multishadow && (turn & 1) )return 0;
4815 if (p_ptr->inside_arena) return 0;
4817 /* Count the casualties */
4820 /* Scan through the slots backwards */
4821 for (i = 0; i < INVEN_PACK; i++)
4823 o_ptr = &inventory[i];
4825 /* Skip non-objects */
4826 if (!o_ptr->k_idx) continue;
4828 /* Hack -- for now, skip artifacts */
4829 if (artifact_p(o_ptr) || o_ptr->art_name) continue;
4831 /* Give this item slot a shot at death */
4834 /* Count the casualties */
4835 for (amt = j = 0; j < o_ptr->number; ++j)
4837 if (rand_int(100) < perc) amt++;
4840 /* Some casualities */
4843 /* Get a description */
4844 object_desc(o_name, o_ptr, FALSE, 3);
4848 msg_format("%s(%c)¤¬%s²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª",
4850 msg_format("%sour %s (%c) %s destroyed!",
4854 o_name, index_to_label(i),
4855 ((o_ptr->number > 1) ?
4856 ((amt == o_ptr->number) ? "Á´Éô" :
4857 (amt > 1 ? "²¿¸Ä¤«" : "°ì¸Ä")) : "") );
4859 ((o_ptr->number > 1) ?
4860 ((amt == o_ptr->number) ? "All of y" :
4861 (amt > 1 ? "Some of y" : "One of y")) : "Y"),
4862 o_name, index_to_label(i),
4863 ((amt > 1) ? "were" : "was"));
4867 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
4868 msg_print("¤ä¤ê¤ä¤¬¤Ã¤¿¤Ê¡ª");
4871 /* Potions smash open */
4872 if (object_is_potion(o_ptr))
4874 (void)potion_smash_effect(0, py, px, o_ptr->k_idx);
4877 /* Reduce the charges of rods/wands */
4878 reduce_charges(o_ptr, amt);
4880 /* Destroy "amt" items */
4881 inven_item_increase(i, -amt);
4882 inven_item_optimize(i);
4884 /* Count the casualties */
4890 /* Return the casualty count */
4896 * Acid has hit the player, attempt to affect some armor.
4898 * Note that the "base armor" of an object never changes.
4900 * If any armor is damaged (or resists), the player takes less damage.
4902 static int minus_ac(void)
4904 object_type *o_ptr = NULL;
4906 char o_name[MAX_NLEN];
4909 /* Pick a (possibly empty) inventory slot */
4912 case 1: o_ptr = &inventory[INVEN_RARM]; break;
4913 case 2: o_ptr = &inventory[INVEN_LARM]; break;
4914 case 3: o_ptr = &inventory[INVEN_BODY]; break;
4915 case 4: o_ptr = &inventory[INVEN_OUTER]; break;
4916 case 5: o_ptr = &inventory[INVEN_HANDS]; break;
4917 case 6: o_ptr = &inventory[INVEN_HEAD]; break;
4918 case 7: o_ptr = &inventory[INVEN_FEET]; break;
4921 /* Nothing to damage */
4922 if (!o_ptr->k_idx) return (FALSE);
4924 if (o_ptr->tval < TV_BOOTS) return (FALSE);
4926 /* No damage left to be done */
4927 if (o_ptr->ac + o_ptr->to_a <= 0) return (FALSE);
4931 object_desc(o_name, o_ptr, FALSE, 0);
4933 /* Extract the flags */
4934 object_flags(o_ptr, &f1, &f2, &f3);
4936 /* Object resists */
4937 if (f3 & TR3_IGNORE_ACID)
4940 msg_format("¤·¤«¤·%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª", o_name);
4942 msg_format("Your %s is unaffected!", o_name);
4951 msg_format("%s¤¬¥À¥á¡¼¥¸¤ò¼õ¤±¤¿¡ª", o_name);
4953 msg_format("Your %s is damaged!", o_name);
4957 /* Damage the item */
4960 /* Calculate bonuses */
4961 p_ptr->update |= (PU_BONUS);
4964 p_ptr->window |= (PW_EQUIP | PW_PLAYER);
4968 /* Item was damaged */
4974 * Hurt the player with Acid
4976 void acid_dam(int dam, cptr kb_str, int monspell)
4978 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
4979 bool double_resist = (p_ptr->oppose_acid || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
4981 /* Total Immunity */
4982 if (p_ptr->immune_acid || (dam <= 0))
4984 learn_spell(monspell);
4988 /* Vulnerability (Ouch!) */
4989 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
4990 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
4992 /* Resist the damage */
4993 if (p_ptr->resist_acid) dam = (dam + 2) / 3;
4994 if (double_resist) dam = (dam + 2) / 3;
4996 if ((!(double_resist || p_ptr->resist_acid)) &&
4997 randint(HURT_CHANCE) == 1)
4998 (void)do_dec_stat(A_CHR);
5000 /* If any armor gets hit, defend the player */
5001 if (minus_ac()) dam = (dam + 1) / 2;
5004 take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
5006 /* Inventory damage */
5007 if (!(double_resist && p_ptr->resist_acid))
5008 inven_damage(set_acid_destroy, inv);
5013 * Hurt the player with electricity
5015 void elec_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_elec || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
5020 /* Total immunity */
5021 if (p_ptr->immune_elec || (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;
5030 if (p_ptr->prace == RACE_ANDROID) dam += dam / 3;
5032 /* Resist the damage */
5033 if (p_ptr->resist_elec) dam = (dam + 2) / 3;
5034 if (double_resist) dam = (dam + 2) / 3;
5036 if ((!(double_resist || p_ptr->resist_elec)) &&
5037 randint(HURT_CHANCE) == 1)
5038 (void)do_dec_stat(A_DEX);
5041 take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
5043 /* Inventory damage */
5044 if (!(double_resist && p_ptr->resist_elec))
5045 inven_damage(set_elec_destroy, inv);
5050 * Hurt the player with Fire
5052 void fire_dam(int dam, cptr kb_str, int monspell)
5054 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
5055 bool double_resist = (p_ptr->oppose_fire || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
5057 /* Totally immune */
5058 if (p_ptr->immune_fire || (dam <= 0))
5060 learn_spell(monspell);
5064 /* Vulnerability (Ouch!) */
5065 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
5066 if (prace_is_(RACE_ENT)) dam += dam / 3;
5067 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
5069 /* Resist the damage */
5070 if (p_ptr->resist_fire) dam = (dam + 2) / 3;
5071 if (double_resist) dam = (dam + 2) / 3;
5073 if ((!(double_resist || p_ptr->resist_fire)) &&
5074 randint(HURT_CHANCE) == 1)
5075 (void)do_dec_stat(A_STR);
5078 take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
5080 /* Inventory damage */
5081 if (!(double_resist && p_ptr->resist_fire))
5082 inven_damage(set_fire_destroy, inv);
5087 * Hurt the player with Cold
5089 void cold_dam(int dam, cptr kb_str, int monspell)
5091 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
5092 bool double_resist = (p_ptr->oppose_cold || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
5094 /* Total immunity */
5095 if (p_ptr->immune_cold || (dam <= 0))
5097 learn_spell(monspell);
5101 /* Vulnerability (Ouch!) */
5102 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
5103 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
5105 /* Resist the damage */
5106 if (p_ptr->resist_cold) dam = (dam + 2) / 3;
5107 if (double_resist) dam = (dam + 2) / 3;
5109 if ((!(double_resist || p_ptr->resist_cold)) &&
5110 randint(HURT_CHANCE) == 1)
5111 (void)do_dec_stat(A_STR);
5114 take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
5116 /* Inventory damage */
5117 if (!(double_resist && p_ptr->resist_cold))
5118 inven_damage(set_cold_destroy, inv);
5122 bool rustproof(void)
5126 char o_name[MAX_NLEN];
5129 item_tester_no_ryoute = TRUE;
5130 /* Select a piece of armour */
5131 item_tester_hook = item_tester_hook_armour;
5135 q = "¤É¤ÎËɶñ¤Ë»¬»ß¤á¤ò¤·¤Þ¤¹¤«¡©";
5136 s = "»¬»ß¤á¤Ç¤¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
5138 q = "Rustproof which piece of armour? ";
5139 s = "You have nothing to rustproof.";
5142 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return FALSE;
5144 /* Get the item (in the pack) */
5147 o_ptr = &inventory[item];
5150 /* Get the item (on the floor) */
5153 o_ptr = &o_list[0 - item];
5158 object_desc(o_name, o_ptr, FALSE, 0);
5160 o_ptr->art_flags3 |= TR3_IGNORE_ACID;
5162 if ((o_ptr->to_a < 0) && !(o_ptr->ident & IDENT_CURSED))
5165 msg_format("%s¤Ï¿·ÉÊƱÍͤˤʤä¿¡ª",o_name);
5167 msg_format("%s %s look%s as good as new!",
5168 ((item >= 0) ? "Your" : "The"), o_name,
5169 ((o_ptr->number > 1) ? "" : "s"));
5176 msg_format("%s¤ÏÉå¿©¤·¤Ê¤¯¤Ê¤Ã¤¿¡£", o_name);
5178 msg_format("%s %s %s now protected against corrosion.",
5179 ((item >= 0) ? "Your" : "The"), o_name,
5180 ((o_ptr->number > 1) ? "are" : "is"));
5191 * Curse the players armor
5193 bool curse_armor(void)
5197 char o_name[MAX_NLEN];
5200 /* Curse the body armor */
5201 o_ptr = &inventory[INVEN_BODY];
5203 /* Nothing to curse */
5204 if (!o_ptr->k_idx) return (FALSE);
5208 object_desc(o_name, o_ptr, FALSE, 3);
5210 /* Attempt a saving throw for artifacts */
5211 if ((o_ptr->art_name || artifact_p(o_ptr)) && (rand_int(100) < 50))
5215 msg_format("%s¤¬%s¤òÊñ¤ß¹þ¤â¤¦¤È¤·¤¿¤¬¡¢%s¤Ï¤½¤ì¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
5216 "¶²ÉݤΰŹõ¥ª¡¼¥é", "Ëɶñ", o_name);
5218 msg_format("A %s tries to %s, but your %s resists the effects!",
5219 "terrible black aura", "surround your armor", o_name);
5224 /* not artifact or failed save... */
5229 msg_format("¶²ÉݤΰŹõ¥ª¡¼¥é¤¬¤¢¤Ê¤¿¤Î%s¤òÊñ¤ß¹þ¤ó¤À¡ª", o_name);
5231 msg_format("A terrible black aura blasts your %s!", o_name);
5234 chg_virtue(V_ENCHANT, -5);
5236 /* Blast the armor */
5238 o_ptr->name2 = EGO_BLASTED;
5239 o_ptr->to_a = 0 - randint(5) - randint(5);
5245 o_ptr->art_flags1 = 0;
5246 o_ptr->art_flags2 = 0;
5247 o_ptr->art_flags3 = 0;
5250 o_ptr->ident |= (IDENT_CURSED);
5253 o_ptr->ident |= (IDENT_BROKEN);
5255 /* Recalculate bonuses */
5256 p_ptr->update |= (PU_BONUS);
5258 /* Recalculate mana */
5259 p_ptr->update |= (PU_MANA);
5262 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
5270 * Curse the players weapon
5272 bool curse_weapon(bool force, int slot)
5276 char o_name[MAX_NLEN];
5279 /* Curse the weapon */
5280 o_ptr = &inventory[slot];
5282 /* Nothing to curse */
5283 if (!o_ptr->k_idx) return (FALSE);
5287 object_desc(o_name, o_ptr, FALSE, 3);
5289 /* Attempt a saving throw */
5290 if ((artifact_p(o_ptr) || o_ptr->art_name) && (rand_int(100) < 50) && !force)
5294 msg_format("%s¤¬%s¤òÊñ¤ß¹þ¤â¤¦¤È¤·¤¿¤¬¡¢%s¤Ï¤½¤ì¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
5295 "¶²ÉݤΰŹõ¥ª¡¼¥é", "Éð´ï", o_name);
5297 msg_format("A %s tries to %s, but your %s resists the effects!",
5298 "terrible black aura", "surround your weapon", o_name);
5303 /* not artifact or failed save... */
5308 if (!force) msg_format("¶²ÉݤΰŹõ¥ª¡¼¥é¤¬¤¢¤Ê¤¿¤Î%s¤òÊñ¤ß¹þ¤ó¤À¡ª", o_name);
5310 if (!force) msg_format("A terrible black aura blasts your %s!", o_name);
5313 chg_virtue(V_ENCHANT, -5);
5315 /* Shatter the weapon */
5317 o_ptr->name2 = EGO_SHATTERED;
5318 o_ptr->to_h = 0 - randint(5) - randint(5);
5319 o_ptr->to_d = 0 - randint(5) - randint(5);
5324 o_ptr->art_flags1 = 0;
5325 o_ptr->art_flags2 = 0;
5326 o_ptr->art_flags3 = 0;
5330 o_ptr->ident |= (IDENT_CURSED);
5333 o_ptr->ident |= (IDENT_BROKEN);
5335 /* Recalculate bonuses */
5336 p_ptr->update |= (PU_BONUS);
5338 /* Recalculate mana */
5339 p_ptr->update |= (PU_MANA);
5342 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
5351 * Enchant some bolts
5353 bool brand_bolts(void)
5357 /* Use the first acceptable bolts */
5358 for (i = 0; i < INVEN_PACK; i++)
5360 object_type *o_ptr = &inventory[i];
5362 /* Skip non-bolts */
5363 if (o_ptr->tval != TV_BOLT) continue;
5365 /* Skip artifacts and ego-items */
5366 if (o_ptr->art_name || artifact_p(o_ptr) || ego_item_p(o_ptr))
5369 /* Skip cursed/broken items */
5370 if (cursed_p(o_ptr) || broken_p(o_ptr)) continue;
5373 if (rand_int(100) < 75) continue;
5377 msg_print("¥¯¥í¥¹¥Ü¥¦¤ÎÌ𤬱ê¤Î¥ª¡¼¥é¤ËÊñ¤Þ¤ì¤¿¡ª");
5379 msg_print("Your bolts are covered in a fiery aura!");
5384 o_ptr->name2 = EGO_FLAME;
5387 enchant(o_ptr, rand_int(3) + 4, ENCH_TOHIT | ENCH_TODAM);
5394 if (flush_failure) flush();
5398 msg_print("±ê¤Ç¶¯²½¤¹¤ë¤Î¤Ë¼ºÇÔ¤·¤¿¡£");
5400 msg_print("The fiery enchantment failed.");
5410 * Helper function -- return a "nearby" race for polymorphing
5412 * Note that this function is one of the more "dangerous" ones...
5414 static s16b poly_r_idx(int r_idx)
5416 monster_race *r_ptr = &r_info[r_idx];
5418 int i, r, lev1, lev2;
5420 /* Hack -- Uniques/Questors never polymorph */
5421 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5422 (r_ptr->flags1 & RF1_QUESTOR))
5425 /* Allowable range of "levels" for resulting monster */
5426 lev1 = r_ptr->level - ((randint(20) / randint(9)) + 1);
5427 lev2 = r_ptr->level + ((randint(20) / randint(9)) + 1);
5429 /* Pick a (possibly new) non-unique race */
5430 for (i = 0; i < 1000; i++)
5432 /* Pick a new race, using a level calculation */
5433 r = get_mon_num((dun_level + r_ptr->level) / 2 + 5);
5435 /* Handle failure */
5441 /* Ignore unique monsters */
5442 if (r_ptr->flags1 & RF1_UNIQUE) continue;
5444 /* Ignore monsters with incompatible levels */
5445 if ((r_ptr->level < lev1) || (r_ptr->level > lev2)) continue;
5447 /* Use that index */
5459 bool polymorph_monster(int y, int x)
5461 cave_type *c_ptr = &cave[y][x];
5462 monster_type *m_ptr = &m_list[c_ptr->m_idx];
5464 bool polymorphed = FALSE;
5466 int old_r_idx = m_ptr->r_idx;
5468 if (p_ptr->inside_arena || p_ptr->inside_battle) return (FALSE);
5470 if ((p_ptr->riding == c_ptr->m_idx) || (m_ptr->mflag2 & MFLAG_KAGE)) return (FALSE);
5472 /* Get the monsters attitude */
5473 friendly = is_friendly(m_ptr);
5474 pet = is_pet(m_ptr);
5476 /* Pick a "new" monster race */
5477 new_r_idx = poly_r_idx(old_r_idx);
5479 /* Handle polymorph */
5480 if (new_r_idx != old_r_idx)
5482 /* "Kill" the "old" monster */
5483 delete_monster_idx(c_ptr->m_idx);
5485 /* Create a new monster (no groups) */
5486 if (place_monster_aux(y, x, new_r_idx, FALSE, FALSE, friendly, pet, FALSE, (bool)(m_ptr->mflag2 & MFLAG_NOPET)))
5493 monster_terrain_sensitive = FALSE;
5495 /* Placing the new monster failed */
5496 place_monster_aux(y, x, old_r_idx, FALSE, FALSE, friendly, pet, TRUE, (bool)(m_ptr->mflag2 & MFLAG_NOPET));
5498 monster_terrain_sensitive = TRUE;
5509 bool dimension_door(void)
5511 int plev = p_ptr->lev;
5514 if (!tgt_pt(&x, &y)) return FALSE;
5516 p_ptr->energy -= 60 - plev;
5518 if (!cave_empty_bold(y, x) || (cave[y][x].info & CAVE_ICKY) ||
5519 (distance(y, x, py, px) > plev / 2 + 10) ||
5520 (!rand_int(plev / 10 + 10)))
5522 if( p_ptr->pclass != CLASS_MIRROR_MASTER ){
5524 msg_print("ÀºÎ¤«¤éʪ¼Á³¦¤ËÌá¤ë»þ¤¦¤Þ¤¯¤¤¤«¤Ê¤«¤Ã¤¿¡ª");
5526 msg_print("You fail to exit the astral plane correctly!");
5531 msg_print("¶À¤ÎÀ¤³¦¤ò¤¦¤Þ¤¯Ä̤ì¤Ê¤«¤Ã¤¿¡ª");
5533 msg_print("You fail to exit the astral plane correctly!");
5536 p_ptr->energy -= 60 - plev;
5537 teleport_player((plev+2)*2);
5539 else teleport_player_to(y, x, TRUE);
5545 bool eat_magic(int power)
5547 object_type * o_ptr;
5550 int recharge_strength = 0;
5556 char o_name[MAX_NLEN];
5558 item_tester_hook = item_tester_hook_recharge;
5562 q = "¤É¤Î¥¢¥¤¥Æ¥à¤«¤éËâÎϤòµÛ¼ý¤·¤Þ¤¹¤«¡©";
5563 s = "ËâÎϤòµÛ¼ý¤Ç¤¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£";
5565 q = "Drain which item? ";
5566 s = "You have nothing to drain.";
5569 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return FALSE;
5573 o_ptr = &inventory[item];
5577 o_ptr = &o_list[0 - item];
5580 k_ptr = &k_info[o_ptr->k_idx];
5581 lev = get_object_level(o_ptr);
5583 if (o_ptr->tval == TV_ROD)
5585 recharge_strength = ((power > lev/2) ? (power - lev/2) : 0) / 5;
5588 if (rand_int(recharge_strength) == 0)
5590 /* Activate the failure code. */
5595 if (o_ptr->timeout > (o_ptr->number - 1) * k_ptr->pval)
5598 msg_print("½¼Å¶Ãæ¤Î¥í¥Ã¥É¤«¤éËâÎϤòµÛ¼ý¤¹¤ë¤³¤È¤Ï¤Ç¤¤Þ¤»¤ó¡£");
5600 msg_print("You can't absorb energy from a discharged rod.");
5607 o_ptr->timeout += k_ptr->pval;
5613 /* All staffs, wands. */
5614 recharge_strength = (100 + power - lev) / 15;
5617 if (recharge_strength < 0) recharge_strength = 0;
5620 if (rand_int(recharge_strength) == 0)
5622 /* Activate the failure code. */
5627 if (o_ptr->pval > 0)
5629 p_ptr->csp += lev / 2;
5632 /* XXX Hack -- unstack if necessary */
5633 if ((o_ptr->tval == TV_STAFF) && (item >= 0) && (o_ptr->number > 1))
5638 /* Get local object */
5641 /* Obtain a local object */
5642 object_copy(q_ptr, o_ptr);
5644 /* Modify quantity */
5647 /* Restore the charges */
5650 /* Unstack the used item */
5652 p_ptr->total_weight -= q_ptr->weight;
5653 item = inven_carry(q_ptr);
5657 msg_print("¾ó¤ò¤Þ¤È¤á¤Ê¤ª¤·¤¿¡£");
5659 msg_print("You unstack your staff.");
5667 msg_print("µÛ¼ý¤Ç¤¤ëËâÎϤ¬¤¢¤ê¤Þ¤»¤ó¡ª");
5669 msg_print("There's no energy there to absorb!");
5673 if (!o_ptr->pval) o_ptr->ident |= IDENT_EMPTY;
5677 /* Inflict the penalties for failing a recharge. */
5680 /* Artifacts are never destroyed. */
5681 if (artifact_p(o_ptr))
5683 object_desc(o_name, o_ptr, TRUE, 0);
5685 msg_format("ËâÎϤ¬µÕή¤·¤¿¡ª%s¤Ï´°Á´¤ËËâÎϤò¼º¤Ã¤¿¡£", o_name);
5687 msg_format("The recharging backfires - %s is completely drained!", o_name);
5691 /* Artifact rods. */
5692 if (o_ptr->tval == TV_ROD)
5693 o_ptr->timeout = k_ptr->pval * o_ptr->number;
5695 /* Artifact wands and staffs. */
5696 else if ((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_STAFF))
5701 /* Get the object description */
5702 object_desc(o_name, o_ptr, FALSE, 0);
5704 /*** Determine Seriousness of Failure ***/
5706 /* Mages recharge objects more safely. */
5707 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)
5709 /* 10% chance to blow up one rod, otherwise draining. */
5710 if (o_ptr->tval == TV_ROD)
5712 if (randint(10) == 1) fail_type = 2;
5715 /* 75% chance to blow up one wand, otherwise draining. */
5716 else if (o_ptr->tval == TV_WAND)
5718 if (randint(3) != 1) fail_type = 2;
5721 /* 50% chance to blow up one staff, otherwise no effect. */
5722 else if (o_ptr->tval == TV_STAFF)
5724 if (randint(2) == 1) fail_type = 2;
5729 /* All other classes get no special favors. */
5732 /* 33% chance to blow up one rod, otherwise draining. */
5733 if (o_ptr->tval == TV_ROD)
5735 if (randint(3) == 1) fail_type = 2;
5738 /* 20% chance of the entire stack, else destroy one wand. */
5739 else if (o_ptr->tval == TV_WAND)
5741 if (randint(5) == 1) fail_type = 3;
5744 /* Blow up one staff. */
5745 else if (o_ptr->tval == TV_STAFF)
5751 /*** Apply draining and destruction. ***/
5753 /* Drain object or stack of objects. */
5756 if (o_ptr->tval == TV_ROD)
5759 msg_print("ËâÎϤ¬µÕÊ®¼Í¤·¤Æ¡¢¥í¥Ã¥É¤«¤é¤µ¤é¤ËËâÎϤòµÛ¤¤¼è¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
5761 msg_print("The recharge backfires, draining the rod further!");
5764 o_ptr->timeout = k_ptr->pval * o_ptr->number;
5766 else if (o_ptr->tval == TV_WAND)
5769 msg_format("%s¤ÏÇË»¤òÌȤ줿¤¬¡¢ËâÎϤ¬Á´¤Æ¼º¤ï¤ì¤¿¡£", o_name);
5771 msg_format("You save your %s from destruction, but all charges are lost.", o_name);
5776 /* Staffs aren't drained. */
5779 /* Destroy an object or one in a stack of objects. */
5782 if (o_ptr->number > 1)
5785 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬°ìËܲõ¤ì¤¿¡ª", o_name);
5787 msg_format("Wild magic consumes one of your %s!", o_name);
5790 /* Reduce rod stack maximum timeout, drain wands. */
5791 if (o_ptr->tval == TV_ROD) o_ptr->timeout -= k_ptr->pval;
5792 if (o_ptr->tval == TV_WAND) o_ptr->pval = o_ptr->pval * (o_ptr->number - 1) / o_ptr->number;
5797 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²¿Ëܤ«²õ¤ì¤¿¡ª", o_name);
5799 msg_format("Wild magic consumes your %s!", o_name);
5802 /* Reduce and describe inventory */
5805 inven_item_increase(item, -1);
5806 inven_item_describe(item);
5807 inven_item_optimize(item);
5810 /* Reduce and describe floor item */
5813 floor_item_increase(0 - item, -1);
5814 floor_item_describe(0 - item);
5815 floor_item_optimize(0 - item);
5819 /* Destroy all members of a stack of objects. */
5822 if (o_ptr->number > 1)
5824 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬Á´¤Æ²õ¤ì¤¿¡ª", o_name);
5826 msg_format("Wild magic consumes all your %s!", o_name);
5831 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²õ¤ì¤¿¡ª", o_name);
5833 msg_format("Wild magic consumes your %s!", o_name);
5838 /* Reduce and describe inventory */
5841 inven_item_increase(item, -999);
5842 inven_item_describe(item);
5843 inven_item_optimize(item);
5846 /* Reduce and describe floor item */
5849 floor_item_increase(0 - item, -999);
5850 floor_item_describe(0 - item);
5851 floor_item_optimize(0 - item);
5857 if (p_ptr->csp > p_ptr->msp)
5859 p_ptr->csp = p_ptr->msp;
5862 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
5863 p_ptr->window |= (PW_INVEN);
5869 bool summon_kin_player(bool pet, int level, int y, int x, bool group)
5871 switch (p_ptr->mimic_form)
5874 switch (p_ptr->prace)
5878 case RACE_BARBARIAN:
5881 summon_kin_type = 'p';
5891 case RACE_MIND_FLAYER:
5894 summon_kin_type = 'h';
5897 summon_kin_type = 'o';
5899 case RACE_HALF_TROLL:
5900 summon_kin_type = 'T';
5902 case RACE_HALF_OGRE:
5903 summon_kin_type = 'O';
5905 case RACE_HALF_GIANT:
5906 case RACE_HALF_TITAN:
5908 summon_kin_type = 'P';
5911 summon_kin_type = 'y';
5914 summon_kin_type = 'K';
5917 summon_kin_type = 'k';
5920 if (one_in_(13)) summon_kin_type = 'U';
5921 else summon_kin_type = 'u';
5923 case RACE_DRACONIAN:
5924 summon_kin_type = 'd';
5928 summon_kin_type = 'g';
5931 if (one_in_(13)) summon_kin_type = 'L';
5932 else summon_kin_type = 's';
5935 summon_kin_type = 'z';
5938 summon_kin_type = 'V';
5941 summon_kin_type = 'G';
5944 summon_kin_type = 'I';
5947 summon_kin_type = '#';
5950 summon_kin_type = 'A';
5953 summon_kin_type = 'U';
5956 summon_kin_type = 'p';
5961 if (one_in_(13)) summon_kin_type = 'U';
5962 else summon_kin_type = 'u';
5964 case MIMIC_DEMON_LORD:
5965 summon_kin_type = 'U';
5968 summon_kin_type = 'V';
5971 return summon_specific((pet ? -1 : 0), y, x, level, SUMMON_KIN, group, FALSE, pet, FALSE, (bool)(!pet));