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);
714 if (i >= 'a' && i <('a'+num))
716 select_dungeon = dun[i-'a'];
722 return select_dungeon;
727 * Recall the player to town or dungeon
729 bool recall_player(int turns)
732 * TODO: Recall the player to the last
733 * visited town when in the wilderness
737 if (p_ptr->inside_arena || ironman_downward)
740 msg_print("²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
742 msg_print("Nothing happens.");
748 if (dun_level && (max_dlv[dungeon_type] > dun_level) && !p_ptr->inside_quest && !p_ptr->word_recall)
751 if (get_check("¤³¤³¤ÏºÇ¿¼Åþ㳬¤è¤êÀõ¤¤³¬¤Ç¤¹¡£¤³¤Î³¬¤ËÌá¤Ã¤ÆÍè¤Þ¤¹¤«¡© "))
753 if (get_check("Reset recall depth? "))
756 max_dlv[dungeon_type] = dun_level;
757 if (record_maxdeapth)
759 do_cmd_write_nikki(NIKKI_TRUMP, dungeon_type, "µ¢´Ô¤Î¤È¤¤Ë");
761 do_cmd_write_nikki(NIKKI_TRUMP, dungeon_type, "when recall from dungeon");
766 if (!p_ptr->word_recall)
772 select_dungeon = choose_dungeon("¤Ëµ¢´Ô");
774 select_dungeon = choose_dungeon("recall");
776 if (!select_dungeon) return FALSE;
777 p_ptr->recall_dungeon = select_dungeon;
779 p_ptr->word_recall = turns;
781 msg_print("²ó¤ê¤ÎÂ絤¤¬Ä¥¤ê¤Ä¤á¤Æ¤¤¿...");
783 msg_print("The air about you becomes charged...");
786 p_ptr->redraw |= (PR_STATUS);
790 p_ptr->word_recall = 0;
792 msg_print("Ä¥¤ê¤Ä¤á¤¿Â絤¤¬Î®¤ìµî¤Ã¤¿...");
794 msg_print("A tension leaves the air around you...");
797 p_ptr->redraw |= (PR_STATUS);
803 bool word_of_recall(void)
805 return(recall_player(rand_int(21) + 15));
809 bool reset_recall(void)
811 int select_dungeon, dummy = 0;
816 select_dungeon = choose_dungeon("¤ò¥»¥Ã¥È");
818 select_dungeon = choose_dungeon("reset");
821 if (!select_dungeon) return FALSE;
824 sprintf(ppp, "²¿³¬¤Ë¥»¥Ã¥È¤·¤Þ¤¹¤« (%d-%d):", d_info[select_dungeon].mindepth, max_dlv[select_dungeon]);
826 sprintf(ppp, "Reset to which level (%d-%d): ", d_info[select_dungeon].mindepth, max_dlv[select_dungeon]);
831 sprintf(tmp_val, "%d", MAX(dun_level, 1));
833 /* Ask for a level */
834 if (get_string(ppp, tmp_val, 10))
836 /* Extract request */
837 dummy = atoi(tmp_val);
840 if (dummy < 1) dummy = 1;
843 if (dummy > max_dlv[select_dungeon]) dummy = max_dlv[select_dungeon];
844 if (dummy < d_info[select_dungeon].mindepth) dummy = d_info[select_dungeon].mindepth;
846 max_dlv[select_dungeon] = dummy;
848 if (record_maxdeapth)
850 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "¥Õ¥í¥¢¡¦¥ê¥»¥Ã¥È¤Ç");
852 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "using a scroll of reset recall");
856 msg_format("%s¤Îµ¢´Ô¥ì¥Ù¥ë¤ò %d ³¬¤Ë¥»¥Ã¥È¡£", d_name+d_info[select_dungeon].name, dummy, dummy * 50);
858 msg_format("Recall depth set to level %d (%d').", dummy, dummy * 50);
871 * Apply disenchantment to the player's stuff
873 * XXX XXX XXX This function is also called from the "melee" code
875 * The "mode" is currently unused.
877 * Return "TRUE" if the player notices anything
879 bool apply_disenchant(int mode)
883 char o_name[MAX_NLEN];
890 /* Pick a random slot */
893 case 1: t = INVEN_RARM; break;
894 case 2: t = INVEN_LARM; break;
895 case 3: t = INVEN_BOW; break;
896 case 4: t = INVEN_BODY; break;
897 case 5: t = INVEN_OUTER; break;
898 case 6: t = INVEN_HEAD; break;
899 case 7: t = INVEN_HANDS; break;
900 case 8: t = INVEN_FEET; break;
904 o_ptr = &inventory[t];
906 /* No item, nothing happens */
907 if (!o_ptr->k_idx) return (FALSE);
910 /* Nothing to disenchant */
911 if ((o_ptr->to_h <= 0) && (o_ptr->to_d <= 0) && (o_ptr->to_a <= 0))
913 /* Nothing to notice */
918 /* Describe the object */
919 object_desc(o_name, o_ptr, FALSE, 0);
922 /* Artifacts have 71% chance to resist */
923 if ((artifact_p(o_ptr) || o_ptr->art_name) && (rand_int(100) < 71))
927 msg_format("%s(%c)¤ÏÎô²½¤òÄ·¤ÍÊÖ¤·¤¿¡ª",o_name, index_to_label(t) );
929 msg_format("Your %s (%c) resist%s disenchantment!",
930 o_name, index_to_label(t),
931 ((o_ptr->number != 1) ? "" : "s"));
940 /* Disenchant tohit */
941 if (o_ptr->to_h > 0) o_ptr->to_h--;
942 if ((o_ptr->to_h > 5) && (rand_int(100) < 20)) o_ptr->to_h--;
944 /* Disenchant todam */
945 if (o_ptr->to_d > 0) o_ptr->to_d--;
946 if ((o_ptr->to_d > 5) && (rand_int(100) < 20)) o_ptr->to_d--;
948 /* Disenchant toac */
949 if (o_ptr->to_a > 0) o_ptr->to_a--;
950 if ((o_ptr->to_a > 5) && (rand_int(100) < 20)) o_ptr->to_a--;
954 msg_format("%s(%c)¤ÏÎô²½¤·¤Æ¤·¤Þ¤Ã¤¿¡ª",
955 o_name, index_to_label(t) );
957 msg_format("Your %s (%c) %s disenchanted!",
958 o_name, index_to_label(t),
959 ((o_ptr->number != 1) ? "were" : "was"));
962 chg_virtue(V_HARMONY, 1);
963 chg_virtue(V_ENCHANT, -2);
965 /* Recalculate bonuses */
966 p_ptr->update |= (PU_BONUS);
969 p_ptr->window |= (PW_EQUIP | PW_PLAYER);
978 void mutate_player(void)
980 int max1, cur1, max2, cur2, ii, jj, i;
982 /* Pick a pair of stats */
984 for (jj = ii; jj == ii; jj = rand_int(6)) /* loop */;
986 max1 = p_ptr->stat_max[ii];
987 cur1 = p_ptr->stat_cur[ii];
988 max2 = p_ptr->stat_max[jj];
989 cur2 = p_ptr->stat_cur[jj];
991 p_ptr->stat_max[ii] = max2;
992 p_ptr->stat_cur[ii] = cur2;
993 p_ptr->stat_max[jj] = max1;
994 p_ptr->stat_cur[jj] = cur1;
998 if(p_ptr->stat_max[i] > p_ptr->stat_max_max[i]) p_ptr->stat_max[i] = p_ptr->stat_max_max[i];
999 if(p_ptr->stat_cur[i] > p_ptr->stat_max_max[i]) p_ptr->stat_cur[i] = p_ptr->stat_max_max[i];
1002 p_ptr->update |= (PU_BONUS);
1009 void apply_nexus(monster_type *m_ptr)
1013 case 1: case 2: case 3:
1015 teleport_player(200);
1021 teleport_player_to(m_ptr->fy, m_ptr->fx, TRUE);
1027 if (rand_int(100) < p_ptr->skill_sav)
1030 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
1032 msg_print("You resist the effects!");
1038 /* Teleport Level */
1039 teleport_player_level();
1045 if (rand_int(100) < p_ptr->skill_sav)
1048 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
1050 msg_print("You resist the effects!");
1057 msg_print("ÂΤ¬¤Í¤¸¤ì»Ï¤á¤¿...");
1059 msg_print("Your body starts to scramble...");
1070 * Charge a lite (torch or latern)
1072 void phlogiston(void)
1075 object_type * o_ptr = &inventory[INVEN_LITE];
1078 if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_LANTERN))
1080 max_flog = FUEL_LAMP;
1084 else if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_TORCH))
1086 max_flog = FUEL_TORCH;
1089 /* No torch to refill */
1093 msg_print("dzÁǤò¾ÃÈñ¤¹¤ë¥¢¥¤¥Æ¥à¤òÁõÈ÷¤·¤Æ¤¤¤Þ¤»¤ó¡£");
1095 msg_print("You are not wielding anything which uses phlogiston.");
1101 if (o_ptr->xtra4 >= max_flog)
1104 msg_print("¤³¤Î¥¢¥¤¥Æ¥à¤Ë¤Ï¤³¤ì°Ê¾ådzÁǤòÊä½¼¤Ç¤¤Þ¤»¤ó¡£");
1106 msg_print("No more phlogiston can be put in this item.");
1113 o_ptr->xtra4 += (max_flog / 2);
1117 msg_print("¾ÈÌÀÍÑ¥¢¥¤¥Æ¥à¤ËdzÁǤòÊä½¼¤·¤¿¡£");
1119 msg_print("You add phlogiston to your light item.");
1124 if (o_ptr->xtra4 >= max_flog)
1126 o_ptr->xtra4 = max_flog;
1128 msg_print("¾ÈÌÀÍÑ¥¢¥¤¥Æ¥à¤ÏËþ¥¿¥ó¤Ë¤Ê¤Ã¤¿¡£");
1130 msg_print("Your light item is full.");
1135 /* Recalculate torch */
1136 p_ptr->update |= (PU_TORCH);
1140 bool item_tester_hook_weapon_nobow(object_type *o_ptr)
1142 switch (o_ptr->tval)
1152 if (o_ptr->sval != SV_DOKUBARI) return (TRUE);
1160 * Brand the current weapon
1162 void brand_weapon(int brand_type)
1169 /* Assume enchant weapon */
1170 item_tester_hook = item_tester_hook_weapon_nobow;
1171 item_tester_no_ryoute = TRUE;
1175 q = "¤É¤ÎÉð´ï¤ò¶¯²½¤·¤Þ¤¹¤«? ";
1176 s = "¶¯²½¤Ç¤¤ëÉð´ï¤¬¤Ê¤¤¡£";
1178 q = "Enchant which weapon? ";
1179 s = "You have nothing to enchant.";
1182 if (!get_item(&item, q, s, (USE_EQUIP))) return;
1184 /* Get the item (in the pack) */
1187 o_ptr = &inventory[item];
1190 /* Get the item (on the floor) */
1193 o_ptr = &o_list[0 - item];
1197 /* you can never modify artifacts / ego-items */
1198 /* you can never modify cursed items */
1199 /* TY: You _can_ modify broken items (if you're silly enough) */
1200 if (o_ptr->k_idx && !artifact_p(o_ptr) && !ego_item_p(o_ptr) &&
1201 !o_ptr->art_name && !cursed_p(o_ptr) &&
1202 !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) &&
1203 !((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE)) &&
1204 !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DIAMOND_EDGE)))
1208 /* Let's get the name before it is changed... */
1209 char o_name[MAX_NLEN];
1210 object_desc(o_name, o_ptr, FALSE, 0);
1215 if (o_ptr->tval == TV_SWORD)
1218 act = "¤Ï±Ô¤µ¤òÁý¤·¤¿¡ª";
1220 act = "becomes very sharp!";
1223 o_ptr->name2 = EGO_SHARPNESS;
1224 o_ptr->pval = m_bonus(5, dun_level) + 1;
1229 act = "¤ÏÇ˲õÎϤòÁý¤·¤¿¡ª";
1231 act = "seems very powerful.";
1234 o_ptr->name2 = EGO_EARTHQUAKES;
1235 o_ptr->pval = m_bonus(3, dun_level);
1240 act = "¤ÏÅÅ·â¤Ëʤ¤ï¤ì¤¿¡ª";
1242 act = "coverd with lightning!";
1245 o_ptr->name2 = EGO_BRAND_ELEC;
1249 act = "¤Ï»À¤Ëʤ¤ï¤ì¤¿¡ª";
1251 act = "coated with acid!";
1254 o_ptr->name2 = EGO_BRAND_ACID;
1258 act = "¤Ï¼Ù°¤Ê¤ë²øʪ¤òµá¤á¤Æ¤¤¤ë¡ª";
1260 act = "seems looking for evil monster!";
1263 o_ptr->name2 = EGO_SLAY_EVIL;
1267 act = "¤Ï°ÛÀ¤³¦¤Î½»¿Í¤ÎÆùÂΤòµá¤á¤Æ¤¤¤ë¡ª";
1269 act = "seems looking for demon!";
1272 o_ptr->name2 = EGO_SLAY_DEMON;
1276 act = "¤Ï»Ó¤òµá¤á¤Æ¤¤¤ë¡ª";
1278 act = "seems looking for undead!";
1281 o_ptr->name2 = EGO_SLAY_UNDEAD;
1285 act = "¤Ïưʪ¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1287 act = "seems looking for animal!";
1290 o_ptr->name2 = EGO_SLAY_ANIMAL;
1294 act = "¤Ï¥É¥é¥´¥ó¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1296 act = "seems looking for dragon!";
1299 o_ptr->name2 = EGO_SLAY_DRAGON;
1303 act = "¤Ï¥È¥í¥ë¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1305 act = "seems looking for troll!";
1308 o_ptr->name2 = EGO_SLAY_TROLL;
1312 act = "¤Ï¥ª¡¼¥¯¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1314 act = "seems looking for orc!";
1317 o_ptr->name2 = EGO_SLAY_ORC;
1321 act = "¤Ïµð¿Í¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1323 act = "seems looking for giant!";
1326 o_ptr->name2 = EGO_SLAY_GIANT;
1330 act = "¤ÏÈó¾ï¤ËÉÔ°ÂÄê¤Ë¤Ê¤Ã¤¿¤è¤¦¤À¡£";
1332 act = "seems very unstable now.";
1335 o_ptr->name2 = EGO_TRUMP;
1336 o_ptr->pval = randint(2);
1340 act = "¤Ï·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1342 act = "thirsts for blood!";
1345 o_ptr->name2 = EGO_VAMPIRIC;
1349 act = "¤ÏÆǤËʤ¤ï¤ì¤¿¡£";
1351 act = "is coated with poison.";
1354 o_ptr->name2 = EGO_BRAND_POIS;
1358 act = "¤Ï½ã¥í¥°¥ë¥¹¤Ë°û¤ß¹þ¤Þ¤ì¤¿¡£";
1360 act = "is engulfed in raw Logrus!";
1363 o_ptr->name2 = EGO_CHAOTIC;
1367 act = "¤Ï±ê¤Î¥·¡¼¥ë¥É¤Ëʤ¤ï¤ì¤¿¡ª";
1369 act = "is covered in a fiery shield!";
1372 o_ptr->name2 = EGO_BRAND_FIRE;
1376 act = "¤Ï¿¼¤¯Î䤿¤¤¥Ö¥ë¡¼¤Ëµ±¤¤¤¿¡ª";
1378 act = "glows deep, icy blue!";
1381 o_ptr->name2 = EGO_BRAND_COLD;
1386 msg_format("¤¢¤Ê¤¿¤Î%s%s", o_name, act);
1388 msg_format("Your %s %s", o_name, act);
1392 enchant(o_ptr, rand_int(3) + 4, ENCH_TOHIT | ENCH_TODAM);
1394 o_ptr->discount = 99;
1395 chg_virtue(V_ENCHANT, 2);
1399 if (flush_failure) flush();
1402 msg_print("°ÀÉղä˼ºÇÔ¤·¤¿¡£");
1404 msg_print("The Branding failed.");
1407 chg_virtue(V_ENCHANT, -2);
1413 void call_the_(void)
1417 if (cave_floor_bold(py - 1, px - 1) &&
1418 cave_floor_bold(py - 1, px ) &&
1419 cave_floor_bold(py - 1, px + 1) &&
1420 cave_floor_bold(py , px - 1) &&
1421 cave_floor_bold(py , px + 1) &&
1422 cave_floor_bold(py + 1, px - 1) &&
1423 cave_floor_bold(py + 1, px ) &&
1424 cave_floor_bold(py + 1, px + 1))
1426 for (i = 1; i < 10; i++)
1428 if (i-5) fire_ball(GF_ROCKET, i, 175, 2);
1431 for (i = 1; i < 10; i++)
1433 if (i-5) fire_ball(GF_MANA, i, 175, 3);
1436 for (i = 1; i < 10; i++)
1438 if (i-5) fire_ball(GF_NUKE, i, 175, 4);
1444 msg_format("¤¢¤Ê¤¿¤Ï%s¤òÊɤ˶᤹¤®¤ë¾ì½ê¤Ç¾§¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª",
1445 ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "µ§¤ê" : "¼öʸ"));
1446 msg_print("Â礤ÊÇúȯ²»¤¬¤¢¤Ã¤¿¡ª");
1448 msg_format("You %s the %s too close to a wall!",
1449 ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "recite" : "cast"),
1450 ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "prayer" : "spell"));
1451 msg_print("There is a loud explosion!");
1455 if (destroy_area(py, px, 15 + p_ptr->lev + rand_int(11), TRUE))
1457 msg_print("¥À¥ó¥¸¥ç¥ó¤¬Êø²õ¤·¤¿...");
1459 msg_print("The dungeon collapses...");
1464 msg_print("¥À¥ó¥¸¥ç¥ó¤ÏÂ礤¯Íɤ줿¡£");
1466 msg_print("The dungeon trembles.");
1471 take_hit(DAMAGE_NOESCAPE, 100 + randint(150), "¼«»¦Åª¤Êµõ̵¾·Íè", -1);
1473 take_hit(DAMAGE_NOESCAPE, 100 + randint(150), "a suicidal Call the Void", -1);
1481 * Fetch an item (teleport it right underneath the caster)
1483 void fetch(int dir, int wgt, bool require_los)
1489 char o_name[MAX_NLEN];
1491 /* Check to see if an object is already there */
1492 if (cave[py][px].o_idx)
1495 msg_print("¼«Ê¬¤Î¤β¼¤Ë¤¢¤ëʪ¤Ï¼è¤ì¤Þ¤»¤ó¡£");
1497 msg_print("You can't fetch when you're already standing on something.");
1504 if (dir == 5 && target_okay())
1509 if (distance(py, px, ty, tx) > MAX_RANGE)
1512 msg_print("¤½¤ó¤Ê¤Ë±ó¤¯¤Ë¤¢¤ëʪ¤Ï¼è¤ì¤Þ¤»¤ó¡ª");
1514 msg_print("You can't fetch something that far away!");
1520 c_ptr = &cave[ty][tx];
1522 /* We need an item to fetch */
1526 msg_print("¤½¤³¤Ë¤Ï²¿¤â¤¢¤ê¤Þ¤»¤ó¡£");
1528 msg_print("There is no object at this place.");
1534 /* No fetching from vault */
1535 if (c_ptr->info & CAVE_ICKY)
1538 msg_print("¥¢¥¤¥Æ¥à¤¬¥³¥ó¥È¥í¡¼¥ë¤ò³°¤ì¤ÆÍî¤Á¤¿¡£");
1540 msg_print("The item slips from your control.");
1546 /* We need to see the item */
1547 if (require_los && !player_has_los_bold(ty, tx))
1550 msg_print("¤½¤³¤Ï¤¢¤Ê¤¿¤Î»ë³¦¤ËÆþ¤Ã¤Æ¤¤¤Þ¤»¤ó¡£");
1552 msg_print("You have no direct line of sight to that location.");
1560 /* Use a direction */
1561 ty = py; /* Where to drop the item */
1569 c_ptr = &cave[ty][tx];
1571 if ((distance(py, px, ty, tx) > MAX_RANGE) ||
1572 !cave_floor_bold(ty, tx)) return;
1574 while (!c_ptr->o_idx);
1577 o_ptr = &o_list[c_ptr->o_idx];
1579 if (o_ptr->weight > wgt)
1581 /* Too heavy to 'fetch' */
1583 msg_print("¤½¤Î¥¢¥¤¥Æ¥à¤Ï½Å²á¤®¤Þ¤¹¡£");
1585 msg_print("The object is too heavy.");
1592 c_ptr->o_idx = o_ptr->next_o_idx;
1593 cave[py][px].o_idx = i; /* 'move' it */
1594 o_ptr->next_o_idx = 0;
1595 o_ptr->iy = (byte)py;
1596 o_ptr->ix = (byte)px;
1598 object_desc(o_name, o_ptr, TRUE, 0);
1600 msg_format("%^s¤¬¤¢¤Ê¤¿¤Î¸µ¤ËÈô¤ó¤Ç¤¤¿¡£", o_name);
1602 msg_format("%^s flies through the air to your feet.", o_name);
1607 p_ptr->redraw |= PR_MAP;
1611 void alter_reality(void)
1613 if (!quest_number(dun_level) && dun_level)
1616 msg_print("À¤³¦¤¬ÊѤï¤Ã¤¿¡ª");
1618 msg_print("The world changes!");
1622 if (autosave_l) do_cmd_save_game(TRUE);
1625 p_ptr->leaving = TRUE;
1630 msg_print("À¤³¦¤¬¾¯¤·¤Î´ÖÊѲ½¤·¤¿¤è¤¦¤À¡£");
1632 msg_print("The world seems to change for a moment!");
1640 * Leave a "glyph of warding" which prevents monster movement
1642 bool warding_glyph(void)
1645 if (!cave_clean_bold(py, px))
1648 msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£");
1650 msg_print("The object resists the spell.");
1656 /* Create a glyph */
1657 cave_set_feat(py, px, FEAT_GLYPH);
1662 bool warding_mirror(void)
1665 if (!cave_clean_bold(py, px))
1668 msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£");
1670 msg_print("The object resists the spell.");
1676 /* Create a glyph */
1677 cave_set_feat(py, px, FEAT_MIRROR);
1686 * Leave an "explosive rune" which prevents monster movement
1688 bool explosive_rune(void)
1691 if (!cave_clean_bold(py, px))
1694 msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£");
1696 msg_print("The object resists the spell.");
1702 /* Create a glyph */
1703 cave_set_feat(py, px, FEAT_MINOR_GLYPH);
1710 * Identify everything being carried.
1711 * Done by a potion of "self knowledge".
1713 void identify_pack(void)
1717 /* Simply identify and know every item */
1718 for (i = 0; i < INVEN_TOTAL; i++)
1720 object_type *o_ptr = &inventory[i];
1722 /* Skip non-objects */
1723 if (!o_ptr->k_idx) continue;
1726 identify_item(o_ptr);
1732 * Used by the "enchant" function (chance of failure)
1733 * (modified for Zangband, we need better stuff there...) -- TY
1735 static int enchant_table[16] =
1737 0, 10, 50, 100, 200,
1738 300, 400, 500, 650, 800,
1739 950, 987, 993, 995, 998,
1745 * Removes curses from items in inventory
1747 * Note that Items which are "Perma-Cursed" (The One Ring,
1748 * The Crown of Morgoth) can NEVER be uncursed.
1750 * Note that if "all" is FALSE, then Items which are
1751 * "Heavy-Cursed" (Mormegil, Calris, and Weapons of Morgul)
1752 * will not be uncursed.
1754 static int remove_curse_aux(int all)
1758 /* Attempt to uncurse items being worn */
1759 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1763 object_type *o_ptr = &inventory[i];
1765 /* Skip non-objects */
1766 if (!o_ptr->k_idx) continue;
1768 /* Uncursed already */
1769 if (!cursed_p(o_ptr)) continue;
1771 /* Extract the flags */
1772 object_flags(o_ptr, &f1, &f2, &f3);
1774 /* Heavily Cursed Items need a special spell */
1775 if (!all && (f3 & TR3_HEAVY_CURSE)) continue;
1777 /* Perma-Cursed Items can NEVER be uncursed */
1778 if (f3 & TR3_PERMA_CURSE) continue;
1781 o_ptr->ident &= ~(IDENT_CURSED);
1783 /* Hack -- Assume felt */
1784 o_ptr->ident |= (IDENT_SENSE);
1786 if (o_ptr->art_flags3 & TR3_CURSED)
1787 o_ptr->art_flags3 &= ~(TR3_CURSED);
1789 if (o_ptr->art_flags3 & TR3_HEAVY_CURSE)
1790 o_ptr->art_flags3 &= ~(TR3_HEAVY_CURSE);
1793 o_ptr->feeling = FEEL_NONE;
1795 /* Recalculate the bonuses */
1796 p_ptr->update |= (PU_BONUS);
1799 p_ptr->window |= (PW_EQUIP);
1801 /* Count the uncursings */
1805 /* Return "something uncursed" */
1811 * Remove most curses
1813 bool remove_curse(void)
1815 return (remove_curse_aux(FALSE));
1821 bool remove_all_curse(void)
1823 return (remove_curse_aux(TRUE));
1828 * Turns an object into gold, gain some of its value in a shop
1837 char o_name[MAX_NLEN];
1838 char out_val[MAX_NLEN+40];
1842 /* Hack -- force destruction */
1843 if (command_arg > 0) force = TRUE;
1847 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò¶â¤ËÊѤ¨¤Þ¤¹¤«¡©";
1848 s = "¶â¤ËÊѤ¨¤é¤ì¤ëʪ¤¬¤¢¤ê¤Þ¤»¤ó¡£";
1850 q = "Turn which item to gold? ";
1851 s = "You have nothing to turn to gold.";
1854 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return (FALSE);
1856 /* Get the item (in the pack) */
1859 o_ptr = &inventory[item];
1862 /* Get the item (on the floor) */
1865 o_ptr = &o_list[0 - item];
1869 /* See how many items */
1870 if (o_ptr->number > 1)
1872 /* Get a quantity */
1873 amt = get_quantity(NULL, o_ptr->number);
1875 /* Allow user abort */
1876 if (amt <= 0) return FALSE;
1880 /* Describe the object */
1881 old_number = o_ptr->number;
1882 o_ptr->number = amt;
1883 object_desc(o_name, o_ptr, TRUE, 3);
1884 o_ptr->number = old_number;
1886 /* Verify unless quantity given */
1889 if (confirm_destroy || (object_value(o_ptr) > 0))
1891 /* Make a verification */
1893 sprintf(out_val, "ËÜÅö¤Ë%s¤ò¶â¤ËÊѤ¨¤Þ¤¹¤«¡©", o_name);
1895 sprintf(out_val, "Really turn %s to gold? ", o_name);
1898 if (!get_check(out_val)) return FALSE;
1902 /* Artifacts cannot be destroyed */
1903 if (artifact_p(o_ptr) || o_ptr->art_name)
1905 byte feel = FEEL_SPECIAL;
1909 msg_format("%s¤ò¶â¤ËÊѤ¨¤ë¤³¤È¤Ë¼ºÇÔ¤·¤¿¡£", o_name);
1911 msg_format("You fail to turn %s to gold!", o_name);
1915 /* Hack -- Handle icky artifacts */
1916 if (cursed_p(o_ptr) || broken_p(o_ptr)) feel = FEEL_TERRIBLE;
1918 /* Hack -- inscribe the artifact */
1919 o_ptr->feeling = feel;
1921 /* We have "felt" it (again) */
1922 o_ptr->ident |= (IDENT_SENSE);
1924 /* Combine the pack */
1925 p_ptr->notice |= (PN_COMBINE);
1928 p_ptr->window |= (PW_INVEN | PW_EQUIP);
1934 price = object_value_real(o_ptr);
1940 msg_format("%s¤ò¥Ë¥»¤Î¶â¤ËÊѤ¨¤¿¡£", o_name);
1942 msg_format("You turn %s to fool's gold.", o_name);
1950 if (amt > 1) price *= amt;
1952 if (price > 30000) price = 30000;
1954 msg_format("%s¤ò¡ð%d ¤Î¶â¤ËÊѤ¨¤¿¡£", o_name, price);
1956 msg_format("You turn %s to %ld coins worth of gold.", o_name, price);
1962 p_ptr->redraw |= (PR_GOLD);
1965 p_ptr->window |= (PW_PLAYER);
1969 /* Eliminate the item (from the pack) */
1972 inven_item_increase(item, -amt);
1973 inven_item_describe(item);
1974 inven_item_optimize(item);
1977 /* Eliminate the item (from the floor) */
1980 floor_item_increase(0 - item, -amt);
1981 floor_item_describe(0 - item);
1982 floor_item_optimize(0 - item);
1990 * Create stairs at the player location
1992 void stair_creation(void)
1995 if (!cave_valid_bold(py, px))
1998 msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£");
2000 msg_print("The object resists the spell.");
2007 delete_object(py, px);
2009 /* Create a staircase */
2010 if (p_ptr->inside_arena || (p_ptr->inside_quest && (p_ptr->inside_quest < MIN_RANDOM_QUEST)) || p_ptr->inside_battle || !dun_level)
2012 /* arena or quest */
2014 msg_print("¸ú²Ì¤¬¤¢¤ê¤Þ¤»¤ó¡ª");
2016 msg_print("There is no effect!");
2020 else if (ironman_downward)
2022 /* Town/wilderness or Ironman */
2023 cave_set_feat(py, px, FEAT_MORE);
2025 else if (quest_number(dun_level) || (dun_level >= d_info[dungeon_type].maxdepth))
2028 cave_set_feat(py, px, FEAT_LESS);
2030 else if (rand_int(100) < 50)
2032 cave_set_feat(py, px, FEAT_MORE);
2036 cave_set_feat(py, px, FEAT_LESS);
2042 * Hook to specify "weapon"
2044 bool item_tester_hook_weapon(object_type *o_ptr)
2046 switch (o_ptr->tval)
2060 if (o_ptr->sval != SV_DOKUBARI) return (TRUE);
2067 bool item_tester_hook_weapon2(object_type *o_ptr)
2069 switch (o_ptr->tval)
2089 * Hook to specify "armour"
2091 bool item_tester_hook_armour(object_type *o_ptr)
2093 switch (o_ptr->tval)
2113 bool item_tester_hook_corpse(object_type *o_ptr)
2115 switch (o_ptr->tval)
2128 * Check if an object is weapon or armour (but not arrow, bolt, or shot)
2130 bool item_tester_hook_weapon_armour(object_type *o_ptr)
2132 switch (o_ptr->tval)
2161 * Break the curse of an item
2163 static void break_curse(object_type *o_ptr)
2167 /* Extract the flags */
2168 object_flags(o_ptr, &f1, &f2, &f3);
2170 if (cursed_p(o_ptr) && !(f3 & TR3_PERMA_CURSE) && !(f3 & TR3_HEAVY_CURSE) && (rand_int(100) < 25))
2173 msg_print("¤«¤±¤é¤ì¤Æ¤¤¤¿¼ö¤¤¤¬ÂǤÁÇˤé¤ì¤¿¡ª");
2175 msg_print("The curse is broken!");
2179 o_ptr->ident &= ~(IDENT_CURSED);
2180 o_ptr->ident |= (IDENT_SENSE);
2182 if (o_ptr->art_flags3 & TR3_CURSED)
2183 o_ptr->art_flags3 &= ~(TR3_CURSED);
2185 o_ptr->feeling = FEEL_NONE;
2191 * Enchants a plus onto an item. -RAK-
2193 * Revamped! Now takes item pointer, number of times to try enchanting,
2194 * and a flag of what to try enchanting. Artifacts resist enchantment
2195 * some of the time, and successful enchantment to at least +0 might
2196 * break a curse on the item. -CFT-
2198 * Note that an item can technically be enchanted all the way to +15 if
2199 * you wait a very, very, long time. Going from +9 to +10 only works
2200 * about 5% of the time, and from +10 to +11 only about 1% of the time.
2202 * Note that this function can now be used on "piles" of items, and
2203 * the larger the pile, the lower the chance of success.
2205 bool enchant(object_type *o_ptr, int n, int eflag)
2207 int i, chance, prob;
2209 bool a = (artifact_p(o_ptr) || o_ptr->art_name);
2210 bool force = (eflag & ENCH_FORCE);
2213 /* Large piles resist enchantment */
2214 prob = o_ptr->number * 100;
2216 /* Missiles are easy to enchant */
2217 if ((o_ptr->tval == TV_BOLT) ||
2218 (o_ptr->tval == TV_ARROW) ||
2219 (o_ptr->tval == TV_SHOT))
2225 for (i = 0; i < n; i++)
2227 /* Hack -- Roll for pile resistance */
2228 if (!force && rand_int(prob) >= 100) continue;
2230 /* Enchant to hit */
2231 if (eflag & ENCH_TOHIT)
2233 if (o_ptr->to_h < 0) chance = 0;
2234 else if (o_ptr->to_h > 15) chance = 1000;
2235 else chance = enchant_table[o_ptr->to_h];
2237 if (force || ((randint(1000) > chance) && (!a || (rand_int(100) < 50))))
2242 /* only when you get it above -1 -CFT */
2243 if (o_ptr->to_h >= 0)
2248 /* Enchant to damage */
2249 if (eflag & ENCH_TODAM)
2251 if (o_ptr->to_d < 0) chance = 0;
2252 else if (o_ptr->to_d > 15) chance = 1000;
2253 else chance = enchant_table[o_ptr->to_d];
2255 if (force || ((randint(1000) > chance) && (!a || (rand_int(100) < 50))))
2260 /* only when you get it above -1 -CFT */
2261 if (o_ptr->to_d >= 0)
2266 /* Enchant to armor class */
2267 if (eflag & ENCH_TOAC)
2269 if (o_ptr->to_a < 0) chance = 0;
2270 else if (o_ptr->to_a > 15) chance = 1000;
2271 else chance = enchant_table[o_ptr->to_a];
2273 if (force || ((randint(1000) > chance) && (!a || (rand_int(100) < 50))))
2278 /* only when you get it above -1 -CFT */
2279 if (o_ptr->to_a >= 0)
2286 if (!res) return (FALSE);
2288 /* Recalculate bonuses */
2289 p_ptr->update |= (PU_BONUS);
2291 /* Combine / Reorder the pack (later) */
2292 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2295 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2306 * Enchant an item (in the inventory or on the floor)
2307 * Note that "num_ac" requires armour, else weapon
2308 * Returns TRUE if attempted, FALSE if cancelled
2310 bool enchant_spell(int num_hit, int num_dam, int num_ac)
2315 char o_name[MAX_NLEN];
2319 /* Assume enchant weapon */
2320 item_tester_hook = item_tester_hook_weapon;
2321 item_tester_no_ryoute = TRUE;
2323 /* Enchant armor if requested */
2324 if (num_ac) item_tester_hook = item_tester_hook_armour;
2328 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò¶¯²½¤·¤Þ¤¹¤«? ";
2329 s = "¶¯²½¤Ç¤¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2331 q = "Enchant which item? ";
2332 s = "You have nothing to enchant.";
2335 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2337 /* Get the item (in the pack) */
2340 o_ptr = &inventory[item];
2343 /* Get the item (on the floor) */
2346 o_ptr = &o_list[0 - item];
2351 object_desc(o_name, o_ptr, FALSE, 0);
2355 msg_format("%s ¤ÏÌÀ¤ë¤¯µ±¤¤¤¿¡ª",
2358 msg_format("%s %s glow%s brightly!",
2359 ((item >= 0) ? "Your" : "The"), o_name,
2360 ((o_ptr->number > 1) ? "" : "s"));
2365 if (enchant(o_ptr, num_hit, ENCH_TOHIT)) okay = TRUE;
2366 if (enchant(o_ptr, num_dam, ENCH_TODAM)) okay = TRUE;
2367 if (enchant(o_ptr, num_ac, ENCH_TOAC)) okay = TRUE;
2373 if (flush_failure) flush();
2377 msg_print("¶¯²½¤Ë¼ºÇÔ¤·¤¿¡£");
2379 msg_print("The enchantment failed.");
2382 if (randint(3)==1) chg_virtue(V_ENCHANT, -1);
2385 chg_virtue(V_ENCHANT, 1);
2389 /* Something happened */
2394 bool artifact_scroll(void)
2399 char o_name[MAX_NLEN];
2403 item_tester_no_ryoute = TRUE;
2404 /* Enchant weapon/armour */
2405 item_tester_hook = item_tester_hook_weapon_armour;
2409 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò¶¯²½¤·¤Þ¤¹¤«? ";
2410 s = "¶¯²½¤Ç¤¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2412 q = "Enchant which item? ";
2413 s = "You have nothing to enchant.";
2416 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2418 /* Get the item (in the pack) */
2421 o_ptr = &inventory[item];
2424 /* Get the item (on the floor) */
2427 o_ptr = &o_list[0 - item];
2432 object_desc(o_name, o_ptr, FALSE, 0);
2436 msg_format("%s ¤ÏâÁ¤¤¸÷¤òȯ¤·¤¿¡ª",o_name);
2438 msg_format("%s %s radiate%s a blinding light!",
2439 ((item >= 0) ? "Your" : "The"), o_name,
2440 ((o_ptr->number > 1) ? "" : "s"));
2443 if (o_ptr->name1 || o_ptr->art_name)
2446 msg_format("%s¤Ï´û¤ËÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Ç¤¹¡ª",
2449 msg_format("The %s %s already %s!",
2450 o_name, ((o_ptr->number > 1) ? "are" : "is"),
2451 ((o_ptr->number > 1) ? "artifacts" : "an artifact"));
2457 else if (o_ptr->name2)
2460 msg_format("%s¤Ï´û¤Ë̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à¤Ç¤¹¡ª",
2463 msg_format("The %s %s already %s!",
2464 o_name, ((o_ptr->number > 1) ? "are" : "is"),
2465 ((o_ptr->number > 1) ? "ego items" : "an ego item"));
2471 else if (o_ptr->xtra3)
2474 msg_format("%s¤Ï´û¤Ë¶¯²½¤µ¤ì¤Æ¤¤¤Þ¤¹¡ª",
2477 msg_format("The %s %s already %s!",
2478 o_name, ((o_ptr->number > 1) ? "are" : "is"),
2479 ((o_ptr->number > 1) ? "kaji items" : "an kaji item"));
2485 if (o_ptr->number > 1)
2488 msg_print("Ê£¿ô¤Î¥¢¥¤¥Æ¥à¤ËËâË¡¤ò¤«¤±¤ë¤À¤±¤Î¥¨¥Í¥ë¥®¡¼¤Ï¤¢¤ê¤Þ¤»¤ó¡ª");
2489 msg_format("%d ¸Ä¤Î%s¤¬²õ¤ì¤¿¡ª",(o_ptr->number)-1, o_name);
2491 msg_print("Not enough enough energy to enchant more than one object!");
2492 msg_format("%d of your %s %s destroyed!",(o_ptr->number)-1, o_name, (o_ptr->number>2?"were":"was"));
2497 inven_item_increase(item, 1-(o_ptr->number));
2501 floor_item_increase(0-item, 1-(o_ptr->number));
2504 okay = create_artifact(o_ptr, TRUE);
2511 if (flush_failure) flush();
2515 msg_print("¶¯²½¤Ë¼ºÇÔ¤·¤¿¡£");
2517 msg_print("The enchantment failed.");
2520 if (randint(3)==1) chg_virtue(V_ENCHANT, -1);
2523 chg_virtue(V_ENCHANT, 1);
2527 /* Something happened */
2533 * Identify an object
2535 void identify_item(object_type *o_ptr)
2537 bool motoart = TRUE;
2538 char o_name[MAX_NLEN];
2541 object_desc(o_name, o_ptr, TRUE, 3);
2543 if ((artifact_p(o_ptr) || o_ptr->art_name) && !(o_ptr->ident & IDENT_KNOWN))
2546 if (!(o_ptr->ident & (IDENT_MENTAL)))
2548 if ((o_ptr->art_name) || (artifact_p(o_ptr)) || one_in_(5))
2549 chg_virtue(V_KNOWLEDGE, 1);
2552 /* Identify it fully */
2553 object_aware(o_ptr);
2554 object_known(o_ptr);
2556 /* Recalculate bonuses */
2557 p_ptr->update |= (PU_BONUS);
2559 /* Combine / Reorder the pack (later) */
2560 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2563 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2565 strcpy(record_o_name, o_name);
2569 object_desc(o_name, o_ptr, TRUE, 0);
2571 if(record_fix_art && !motoart && artifact_p(o_ptr))
2572 do_cmd_write_nikki(NIKKI_ART, 0, o_name);
2573 if(record_rand_art && !motoart && o_ptr->art_name)
2574 do_cmd_write_nikki(NIKKI_ART, 0, o_name);
2578 bool item_tester_hook_identify(object_type *o_ptr)
2580 return (bool)!object_known_p(o_ptr);
2583 bool item_tester_hook_identify_weapon_armour(object_type *o_ptr)
2585 if (object_known_p(o_ptr))
2587 return item_tester_hook_weapon_armour(o_ptr);
2591 * Identify an object in the inventory (or on the floor)
2592 * This routine does *not* automatically combine objects.
2593 * Returns TRUE if something was identified, else FALSE.
2595 bool ident_spell(bool only_equip)
2599 char o_name[MAX_NLEN];
2602 item_tester_no_ryoute = TRUE;
2605 item_tester_hook = item_tester_hook_identify_weapon_armour;
2607 item_tester_hook = item_tester_hook_identify;
2609 if (!can_get_item())
2613 item_tester_hook = item_tester_hook_weapon_armour;
2617 item_tester_hook = NULL;
2623 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò´ÕÄꤷ¤Þ¤¹¤«? ";
2624 s = "´ÕÄꤹ¤ë¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2626 q = "Identify which item? ";
2627 s = "You have nothing to identify.";
2630 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2632 /* Get the item (in the pack) */
2635 o_ptr = &inventory[item];
2638 /* Get the item (on the floor) */
2641 o_ptr = &o_list[0 - item];
2645 identify_item(o_ptr);
2648 object_desc(o_name, o_ptr, TRUE, 3);
2651 if (item >= INVEN_RARM)
2654 msg_format("%^s: %s(%c)¡£",
2656 msg_format("%^s: %s (%c).",
2659 describe_use(item), o_name, index_to_label(item));
2664 msg_format("¥¶¥Ã¥¯Ãæ: %s(%c)¡£",
2666 msg_format("In your pack: %s (%c).",
2669 o_name, index_to_label(item));
2674 msg_format("¾²¾å: %s¡£",
2676 msg_format("On the ground: %s.",
2682 /* Something happened */
2688 * Mundanify an object in the inventory (or on the floor)
2689 * This routine does *not* automatically combine objects.
2690 * Returns TRUE if something was mundanified, else FALSE.
2692 bool mundane_spell(bool only_equip)
2698 if (only_equip) item_tester_hook = item_tester_hook_weapon_armour;
2699 item_tester_no_ryoute = TRUE;
2703 q = "¤É¤ì¤ò»È¤¤¤Þ¤¹¤«¡©";
2704 s = "»È¤¨¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
2706 q = "Use which item? ";
2707 s = "You have nothing you can use.";
2710 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2712 /* Get the item (in the pack) */
2715 o_ptr = &inventory[item];
2718 /* Get the item (on the floor) */
2721 o_ptr = &o_list[0 - item];
2726 msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
2728 msg_print("There is a bright flash of light!");
2731 byte iy = o_ptr->iy; /* Y-position on map, or zero */
2732 byte ix = o_ptr->ix; /* X-position on map, or zero */
2733 s16b next_o_idx= o_ptr->next_o_idx; /* Next object in stack (if any) */
2734 byte marked=o_ptr->marked; /* Object is marked */
2735 s16b weight = (o_ptr->number*o_ptr->weight);
2738 object_prep(o_ptr, o_ptr->k_idx);
2742 o_ptr->next_o_idx=next_o_idx;
2743 o_ptr->marked=marked;
2744 if (item >= 0) p_ptr->total_weight += (o_ptr->weight - weight);
2748 /* Something happened */
2754 bool item_tester_hook_identify_fully(object_type *o_ptr)
2756 return (bool)(!object_known_p(o_ptr) || !(o_ptr->ident & IDENT_MENTAL));
2759 bool item_tester_hook_identify_fully_weapon_armour(object_type *o_ptr)
2761 if (!item_tester_hook_identify_fully(o_ptr))
2763 return item_tester_hook_weapon_armour(o_ptr);
2767 * Fully "identify" an object in the inventory -BEN-
2768 * This routine returns TRUE if an item was identified.
2770 bool identify_fully(bool only_equip)
2774 char o_name[MAX_NLEN];
2777 item_tester_no_ryoute = TRUE;
2779 item_tester_hook = item_tester_hook_identify_fully_weapon_armour;
2781 item_tester_hook = item_tester_hook_identify_fully;
2783 if (!can_get_item())
2786 item_tester_hook = item_tester_hook_weapon_armour;
2788 item_tester_hook = NULL;
2793 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò´ÕÄꤷ¤Þ¤¹¤«? ";
2794 s = "´ÕÄꤹ¤ë¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2796 q = "Identify which item? ";
2797 s = "You have nothing to identify.";
2800 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2802 /* Get the item (in the pack) */
2805 o_ptr = &inventory[item];
2808 /* Get the item (on the floor) */
2811 o_ptr = &o_list[0 - item];
2815 identify_item(o_ptr);
2817 /* Mark the item as fully known */
2818 o_ptr->ident |= (IDENT_MENTAL);
2824 object_desc(o_name, o_ptr, TRUE, 3);
2827 if (item >= INVEN_RARM)
2830 msg_format("%^s: %s(%c)¡£",
2832 msg_format("%^s: %s (%c).",
2835 describe_use(item), o_name, index_to_label(item));
2840 msg_format("¥¶¥Ã¥¯Ãæ: %s(%c)¡£",
2842 msg_format("In your pack: %s (%c).",
2845 o_name, index_to_label(item));
2850 msg_format("¾²¾å: %s¡£",
2852 msg_format("On the ground: %s.",
2858 /* Describe it fully */
2859 (void)identify_fully_aux(o_ptr);
2869 * Hook for "get_item()". Determine if something is rechargable.
2871 bool item_tester_hook_recharge(object_type *o_ptr)
2873 /* Recharge staffs */
2874 if (o_ptr->tval == TV_STAFF) return (TRUE);
2876 /* Recharge wands */
2877 if (o_ptr->tval == TV_WAND) return (TRUE);
2879 /* Hack -- Recharge rods */
2880 if (o_ptr->tval == TV_ROD) return (TRUE);
2888 * Recharge a wand/staff/rod from the pack or on the floor.
2889 * This function has been rewritten in Oangband and ZAngband.
2891 * Sorcery/Arcane -- Recharge --> recharge(plev * 4)
2892 * Chaos -- Arcane Binding --> recharge(90)
2894 * Scroll of recharging --> recharge(130)
2895 * Artifact activation/Thingol --> recharge(130)
2897 * It is harder to recharge high level, and highly charged wands,
2898 * staffs, and rods. The more wands in a stack, the more easily and
2899 * strongly they recharge. Staffs, however, each get fewer charges if
2902 * XXX XXX XXX Beware of "sliding index errors".
2904 bool recharge(int power)
2907 int recharge_strength, recharge_amount;
2916 char o_name[MAX_NLEN];
2918 /* Only accept legal items */
2919 item_tester_hook = item_tester_hook_recharge;
2923 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ËËâÎϤò½¼Å¶¤·¤Þ¤¹¤«? ";
2924 s = "ËâÎϤò½¼Å¶¤¹¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2926 q = "Recharge which item? ";
2927 s = "You have nothing to recharge.";
2930 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return (FALSE);
2932 /* Get the item (in the pack) */
2935 o_ptr = &inventory[item];
2938 /* Get the item (on the floor) */
2941 o_ptr = &o_list[0 - item];
2944 /* Get the object kind. */
2945 k_ptr = &k_info[o_ptr->k_idx];
2947 /* Extract the object "level" */
2948 lev = get_object_level(o_ptr);
2951 /* Recharge a rod */
2952 if (o_ptr->tval == TV_ROD)
2954 /* Extract a recharge strength by comparing object level to power. */
2955 recharge_strength = ((power > lev/2) ? (power - lev/2) : 0) / 5;
2959 if (rand_int(recharge_strength) == 0)
2961 /* Activate the failure code. */
2968 /* Recharge amount */
2969 recharge_amount = (power * damroll(3, 2));
2971 /* Recharge by that amount */
2972 if (o_ptr->timeout > recharge_amount)
2973 o_ptr->timeout -= recharge_amount;
2980 /* Recharge wand/staff */
2983 /* Extract a recharge strength by comparing object level to power.
2984 * Divide up a stack of wands' charges to calculate charge penalty.
2986 if ((o_ptr->tval == TV_WAND) && (o_ptr->number > 1))
2987 recharge_strength = (100 + power - lev -
2988 (8 * o_ptr->pval / o_ptr->number)) / 15;
2990 /* All staffs, unstacked wands. */
2991 else recharge_strength = (100 + power - lev -
2992 (8 * o_ptr->pval)) / 15;
2995 if (recharge_strength < 0) recharge_strength = 0;
2998 if (rand_int(recharge_strength) == 0)
3000 /* Activate the failure code. */
3004 /* If the spell didn't backfire, recharge the wand or staff. */
3007 /* Recharge based on the standard number of charges. */
3008 recharge_amount = randint(1 + k_ptr->pval / 2);
3010 /* Multiple wands in a stack increase recharging somewhat. */
3011 if ((o_ptr->tval == TV_WAND) && (o_ptr->number > 1))
3014 (randint(recharge_amount * (o_ptr->number - 1))) / 2;
3015 if (recharge_amount < 1) recharge_amount = 1;
3016 if (recharge_amount > 12) recharge_amount = 12;
3019 /* But each staff in a stack gets fewer additional charges,
3020 * although always at least one.
3022 if ((o_ptr->tval == TV_STAFF) && (o_ptr->number > 1))
3024 recharge_amount /= o_ptr->number;
3025 if (recharge_amount < 1) recharge_amount = 1;
3028 /* Recharge the wand or staff. */
3029 o_ptr->pval += recharge_amount;
3032 /* Hack -- we no longer "know" the item */
3033 o_ptr->ident &= ~(IDENT_KNOWN);
3035 /* Hack -- we no longer think the item is empty */
3036 o_ptr->ident &= ~(IDENT_EMPTY);
3041 /* Inflict the penalties for failing a recharge. */
3044 /* Artifacts are never destroyed. */
3045 if (artifact_p(o_ptr))
3047 object_desc(o_name, o_ptr, TRUE, 0);
3049 msg_format("ËâÎϤ¬µÕή¤·¤¿¡ª%s¤Ï´°Á´¤ËËâÎϤò¼º¤Ã¤¿¡£", o_name);
3051 msg_format("The recharging backfires - %s is completely drained!", o_name);
3055 /* Artifact rods. */
3056 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout < 10000))
3057 o_ptr->timeout = (o_ptr->timeout + 100) * 2;
3059 /* Artifact wands and staffs. */
3060 else if ((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_STAFF))
3065 /* Get the object description */
3066 object_desc(o_name, o_ptr, FALSE, 0);
3068 /*** Determine Seriousness of Failure ***/
3070 /* Mages recharge objects more safely. */
3071 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)
3073 /* 10% chance to blow up one rod, otherwise draining. */
3074 if (o_ptr->tval == TV_ROD)
3076 if (randint(10) == 1) fail_type = 2;
3079 /* 75% chance to blow up one wand, otherwise draining. */
3080 else if (o_ptr->tval == TV_WAND)
3082 if (randint(3) != 1) fail_type = 2;
3085 /* 50% chance to blow up one staff, otherwise no effect. */
3086 else if (o_ptr->tval == TV_STAFF)
3088 if (randint(2) == 1) fail_type = 2;
3093 /* All other classes get no special favors. */
3096 /* 33% chance to blow up one rod, otherwise draining. */
3097 if (o_ptr->tval == TV_ROD)
3099 if (randint(3) == 1) fail_type = 2;
3102 /* 20% chance of the entire stack, else destroy one wand. */
3103 else if (o_ptr->tval == TV_WAND)
3105 if (randint(5) == 1) fail_type = 3;
3108 /* Blow up one staff. */
3109 else if (o_ptr->tval == TV_STAFF)
3115 /*** Apply draining and destruction. ***/
3117 /* Drain object or stack of objects. */
3120 if (o_ptr->tval == TV_ROD)
3123 msg_print("ËâÎϤ¬µÕÊ®¼Í¤·¤Æ¡¢¥í¥Ã¥É¤«¤é¤µ¤é¤ËËâÎϤòµÛ¤¤¼è¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
3125 msg_print("The recharge backfires, draining the rod further!");
3128 if (o_ptr->timeout < 10000)
3129 o_ptr->timeout = (o_ptr->timeout + 100) * 2;
3131 else if (o_ptr->tval == TV_WAND)
3134 msg_format("%s¤ÏÇË»¤òÌȤ줿¤¬¡¢ËâÎϤ¬Á´¤Æ¼º¤ï¤ì¤¿¡£", o_name);
3136 msg_format("You save your %s from destruction, but all charges are lost.", o_name);
3141 /* Staffs aren't drained. */
3144 /* Destroy an object or one in a stack of objects. */
3147 if (o_ptr->number > 1)
3149 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬°ìËܲõ¤ì¤¿¡ª", o_name);
3151 msg_format("Wild magic consumes one of your %s!", o_name);
3156 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²õ¤ì¤¿¡ª", o_name);
3158 msg_format("Wild magic consumes your %s!", o_name);
3162 /* Reduce rod stack maximum timeout, drain wands. */
3163 if (o_ptr->tval == TV_ROD) o_ptr->timeout = (o_ptr->number - 1) * k_ptr->pval;
3164 if (o_ptr->tval == TV_WAND) o_ptr->pval = 0;
3166 /* Reduce and describe inventory */
3169 inven_item_increase(item, -1);
3170 inven_item_describe(item);
3171 inven_item_optimize(item);
3174 /* Reduce and describe floor item */
3177 floor_item_increase(0 - item, -1);
3178 floor_item_describe(0 - item);
3179 floor_item_optimize(0 - item);
3183 /* Destroy all members of a stack of objects. */
3186 if (o_ptr->number > 1)
3188 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬Á´¤Æ²õ¤ì¤¿¡ª", o_name);
3190 msg_format("Wild magic consumes all your %s!", o_name);
3195 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²õ¤ì¤¿¡ª", o_name);
3197 msg_format("Wild magic consumes your %s!", o_name);
3202 /* Reduce and describe inventory */
3205 inven_item_increase(item, -999);
3206 inven_item_describe(item);
3207 inven_item_optimize(item);
3210 /* Reduce and describe floor item */
3213 floor_item_increase(0 - item, -999);
3214 floor_item_describe(0 - item);
3215 floor_item_optimize(0 - item);
3221 /* Combine / Reorder the pack (later) */
3222 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
3225 p_ptr->window |= (PW_INVEN);
3227 /* Something was done */
3235 bool bless_weapon(void)
3240 char o_name[MAX_NLEN];
3243 item_tester_no_ryoute = TRUE;
3244 /* Assume enchant weapon */
3245 item_tester_hook = item_tester_hook_weapon2;
3249 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò½ËÊ¡¤·¤Þ¤¹¤«¡©";
3250 s = "½ËÊ¡¤Ç¤¤ëÉð´ï¤¬¤¢¤ê¤Þ¤»¤ó¡£";
3252 q = "Bless which weapon? ";
3253 s = "You have weapon to bless.";
3256 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR)))
3259 /* Get the item (in the pack) */
3262 o_ptr = &inventory[item];
3265 /* Get the item (on the floor) */
3268 o_ptr = &o_list[0 - item];
3273 object_desc(o_name, o_ptr, FALSE, 0);
3275 /* Extract the flags */
3276 object_flags(o_ptr, &f1, &f2, &f3);
3278 if (o_ptr->ident & IDENT_CURSED)
3280 if (((f3 & TR3_HEAVY_CURSE) && (randint(100) < 33)) ||
3281 (f3 & TR3_PERMA_CURSE))
3284 msg_format("%s¤òʤ¤¦¹õ¤¤¥ª¡¼¥é¤Ï½ËÊ¡¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
3287 msg_format("The black aura on %s %s disrupts the blessing!",
3288 ((item >= 0) ? "your" : "the"), o_name);
3295 msg_format("%s ¤«¤é¼Ù°¤Ê¥ª¡¼¥é¤¬¾Ã¤¨¤¿¡£",
3298 msg_format("A malignant aura leaves %s %s.",
3299 ((item >= 0) ? "your" : "the"), o_name);
3304 o_ptr->ident &= ~(IDENT_CURSED);
3306 /* Hack -- Assume felt */
3307 o_ptr->ident |= (IDENT_SENSE);
3310 o_ptr->feeling = FEEL_NONE;
3312 /* Recalculate the bonuses */
3313 p_ptr->update |= (PU_BONUS);
3316 p_ptr->window |= (PW_EQUIP);
3320 * Next, we try to bless it. Artifacts have a 1/3 chance of
3321 * being blessed, otherwise, the operation simply disenchants
3322 * them, godly power negating the magic. Ok, the explanation
3323 * is silly, but otherwise priests would always bless every
3324 * artifact weapon they find. Ego weapons and normal weapons
3325 * can be blessed automatically.
3327 if (f3 & TR3_BLESSED)
3330 msg_format("%s ¤Ï´û¤Ë½ËÊ¡¤µ¤ì¤Æ¤¤¤ë¡£",
3333 msg_format("%s %s %s blessed already.",
3334 ((item >= 0) ? "Your" : "The"), o_name,
3335 ((o_ptr->number > 1) ? "were" : "was"));
3341 if (!(o_ptr->art_name || o_ptr->name1 || o_ptr->name2) || (randint(3) == 1))
3345 msg_format("%s¤Ïµ±¤¤¤¿¡ª",
3348 msg_format("%s %s shine%s!",
3349 ((item >= 0) ? "Your" : "The"), o_name,
3350 ((o_ptr->number > 1) ? "" : "s"));
3353 o_ptr->art_flags3 |= TR3_BLESSED;
3354 o_ptr->discount = 99;
3358 bool dis_happened = FALSE;
3361 msg_print("¤½¤ÎÉð´ï¤Ï½ËÊ¡¤ò·ù¤Ã¤Æ¤¤¤ë¡ª");
3363 msg_print("The weapon resists your blessing!");
3367 /* Disenchant tohit */
3368 if (o_ptr->to_h > 0)
3371 dis_happened = TRUE;
3374 if ((o_ptr->to_h > 5) && (rand_int(100) < 33)) o_ptr->to_h--;
3376 /* Disenchant todam */
3377 if (o_ptr->to_d > 0)
3380 dis_happened = TRUE;
3383 if ((o_ptr->to_d > 5) && (rand_int(100) < 33)) o_ptr->to_d--;
3385 /* Disenchant toac */
3386 if (o_ptr->to_a > 0)
3389 dis_happened = TRUE;
3392 if ((o_ptr->to_a > 5) && (rand_int(100) < 33)) o_ptr->to_a--;
3397 msg_print("¼þ°Ï¤¬ËÞÍǤÊÊ·°Ïµ¤¤ÇËþ¤Á¤¿...");
3399 msg_print("There is a static feeling in the air...");
3403 msg_format("%s ¤ÏÎô²½¤·¤¿¡ª",
3406 msg_format("%s %s %s disenchanted!",
3407 ((item >= 0) ? "Your" : "The"), o_name,
3408 ((o_ptr->number > 1) ? "were" : "was"));
3414 /* Recalculate bonuses */
3415 p_ptr->update |= (PU_BONUS);
3418 p_ptr->window |= (PW_EQUIP | PW_PLAYER);
3429 bool pulish_shield(void)
3434 char o_name[MAX_NLEN];
3437 item_tester_no_ryoute = TRUE;
3438 /* Assume enchant weapon */
3439 item_tester_tval = TV_SHIELD;
3443 q = "¤É¤Î½â¤òËᤤޤ¹¤«¡©";
3444 s = "Ë᤯½â¤¬¤¢¤ê¤Þ¤»¤ó¡£";
3446 q = "Pulish which weapon? ";
3447 s = "You have weapon to pulish.";
3450 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR)))
3453 /* Get the item (in the pack) */
3456 o_ptr = &inventory[item];
3459 /* Get the item (on the floor) */
3462 o_ptr = &o_list[0 - item];
3467 object_desc(o_name, o_ptr, FALSE, 0);
3469 /* Extract the flags */
3470 object_flags(o_ptr, &f1, &f2, &f3);
3472 if (o_ptr->k_idx && !artifact_p(o_ptr) && !ego_item_p(o_ptr) &&
3473 !o_ptr->art_name && !cursed_p(o_ptr) && (o_ptr->sval != SV_SHIELD_OF_DEFLECTION))
3476 msg_format("%s¤Ïµ±¤¤¤¿¡ª", o_name);
3478 msg_format("%s %s shine%s!",
3479 ((item >= 0) ? "Your" : "The"), o_name,
3480 ((o_ptr->number > 1) ? "" : "s"));
3482 o_ptr->name2 = EGO_REFLECTION;
3483 enchant(o_ptr, rand_int(3) + 4, ENCH_TOAC);
3485 o_ptr->discount = 99;
3486 chg_virtue(V_ENCHANT, 2);
3492 if (flush_failure) flush();
3495 msg_print("¼ºÇÔ¤·¤¿¡£");
3497 msg_print("Failed.");
3500 chg_virtue(V_ENCHANT, -2);
3509 * Potions "smash open" and cause an area effect when
3510 * (1) they are shattered while in the player's inventory,
3511 * due to cold (etc) attacks;
3512 * (2) they are thrown at a monster, or obstacle;
3513 * (3) they are shattered by a "cold ball" or other such spell
3514 * while lying on the floor.
3517 * who --- who caused the potion to shatter (0=player)
3518 * potions that smash on the floor are assumed to
3519 * be caused by no-one (who = 1), as are those that
3520 * shatter inside the player inventory.
3521 * (Not anymore -- I changed this; TY)
3522 * y, x --- coordinates of the potion (or player if
3523 * the potion was in her inventory);
3524 * o_ptr --- pointer to the potion object.
3526 bool potion_smash_effect(int who, int y, int x, int k_idx)
3534 object_kind *k_ptr = &k_info[k_idx];
3536 switch (k_ptr->sval)
3538 case SV_POTION_SALT_WATER:
3539 case SV_POTION_SLIME_MOLD:
3540 case SV_POTION_LOSE_MEMORIES:
3541 case SV_POTION_DEC_STR:
3542 case SV_POTION_DEC_INT:
3543 case SV_POTION_DEC_WIS:
3544 case SV_POTION_DEC_DEX:
3545 case SV_POTION_DEC_CON:
3546 case SV_POTION_DEC_CHR:
3547 case SV_POTION_WATER: /* perhaps a 'water' attack? */
3548 case SV_POTION_APPLE_JUICE:
3551 case SV_POTION_INFRAVISION:
3552 case SV_POTION_DETECT_INVIS:
3553 case SV_POTION_SLOW_POISON:
3554 case SV_POTION_CURE_POISON:
3555 case SV_POTION_BOLDNESS:
3556 case SV_POTION_RESIST_HEAT:
3557 case SV_POTION_RESIST_COLD:
3558 case SV_POTION_HEROISM:
3559 case SV_POTION_BESERK_STRENGTH:
3560 case SV_POTION_RES_STR:
3561 case SV_POTION_RES_INT:
3562 case SV_POTION_RES_WIS:
3563 case SV_POTION_RES_DEX:
3564 case SV_POTION_RES_CON:
3565 case SV_POTION_RES_CHR:
3566 case SV_POTION_INC_STR:
3567 case SV_POTION_INC_INT:
3568 case SV_POTION_INC_WIS:
3569 case SV_POTION_INC_DEX:
3570 case SV_POTION_INC_CON:
3571 case SV_POTION_INC_CHR:
3572 case SV_POTION_AUGMENTATION:
3573 case SV_POTION_ENLIGHTENMENT:
3574 case SV_POTION_STAR_ENLIGHTENMENT:
3575 case SV_POTION_SELF_KNOWLEDGE:
3576 case SV_POTION_EXPERIENCE:
3577 case SV_POTION_RESISTANCE:
3578 case SV_POTION_INVULNERABILITY:
3579 case SV_POTION_NEW_LIFE:
3580 /* All of the above potions have no effect when shattered */
3582 case SV_POTION_SLOWNESS:
3588 case SV_POTION_POISON:
3594 case SV_POTION_BLINDNESS:
3599 case SV_POTION_CONFUSION: /* Booze */
3604 case SV_POTION_SLEEP:
3609 case SV_POTION_RUINATION:
3610 case SV_POTION_DETONATIONS:
3612 dam = damroll(25, 25);
3616 case SV_POTION_DEATH:
3617 dt = GF_DEATH_RAY; /* !! */
3618 dam = k_ptr->level * 10;
3623 case SV_POTION_SPEED:
3627 case SV_POTION_CURE_LIGHT:
3629 dam = damroll(2, 3);
3632 case SV_POTION_CURE_SERIOUS:
3634 dam = damroll(4, 3);
3637 case SV_POTION_CURE_CRITICAL:
3638 case SV_POTION_CURING:
3640 dam = damroll(6, 3);
3643 case SV_POTION_HEALING:
3645 dam = damroll(10, 10);
3648 case SV_POTION_RESTORE_EXP:
3654 case SV_POTION_LIFE:
3656 dam = damroll(50, 50);
3660 case SV_POTION_STAR_HEALING:
3662 dam = damroll(50, 50);
3666 case SV_POTION_RESTORE_MANA: /* MANA */
3668 dam = damroll(10, 10);
3676 (void)project(who, radius, y, x, dam, dt,
3677 (PROJECT_JUMP | PROJECT_ITEM | PROJECT_KILL), -1);
3679 /* XXX those potions that explode need to become "known" */
3685 * Hack -- Display all known spells in a window
3687 * XXX XXX XXX Need to analyze size of the window.
3689 * XXX XXX XXX Need more color coding.
3691 void display_spell_list(void)
3695 int use_realm1 = p_ptr->realm1 - 1;
3696 int use_realm2 = p_ptr->realm2 - 1;
3706 /* Warriors are illiterate */
3707 if (!mp_ptr->spell_book) return;
3708 if (p_ptr->pclass == CLASS_SORCERER) return;
3709 if (p_ptr->pclass == CLASS_RED_MAGE) return;
3711 /* Mindcrafter spell-list */
3712 if ((p_ptr->pclass == CLASS_MINDCRAFTER) || (p_ptr->pclass == CLASS_FORCETRAINER))
3718 int plev = p_ptr->lev;
3725 /* Display a list of spells */
3728 put_str("̾Á°", y, x + 5);
3729 put_str("Lv MP ¼ºÎ¨ ¸ú²Ì", y, x + 35);
3731 put_str("Name", y, x + 5);
3732 put_str("Lv Mana Fail Info", y, x + 35);
3735 switch(p_ptr->pclass)
3737 case CLASS_MINDCRAFTER: use_mind = MIND_MINDCRAFTER;break;
3738 case CLASS_FORCETRAINER: use_mind = MIND_KI;break;
3739 default: use_mind = 0;break;
3742 /* Dump the spells */
3743 for (i = 0; i < MAX_MIND_POWERS; i++)
3745 byte a = TERM_WHITE;
3747 /* Access the available spell */
3748 spell = mind_powers[use_mind].info[i];
3749 if (spell.min_lev > plev) break;
3751 /* Get the failure rate */
3752 chance = spell.fail;
3754 /* Reduce failure rate by "effective" level adjustment */
3755 chance -= 3 * (p_ptr->lev - spell.min_lev);
3757 /* Reduce failure rate by INT/WIS adjustment */
3758 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
3760 /* Not enough mana to cast */
3761 if (spell.mana_cost > p_ptr->csp)
3763 chance += 5 * (spell.mana_cost - p_ptr->csp);
3767 /* Extract the minimum failure rate */
3768 minfail = adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]];
3770 /* Minimum failure rate */
3771 if (chance < minfail) chance = minfail;
3773 /* Stunning makes spells harder */
3774 if (p_ptr->stun > 50) chance += 25;
3775 else if (p_ptr->stun) chance += 15;
3777 /* Always a 5 percent chance of working */
3778 if (chance > 95) chance = 95;
3781 mindcraft_info(comment, use_mind, i);
3783 /* Dump the spell */
3784 sprintf(psi_desc, " %c) %-30s%2d %4d %3d%%%s",
3786 spell.min_lev, spell.mana_cost, chance, comment);
3788 Term_putstr(x, y + i + 1, -1, a, psi_desc);
3793 /* Normal spellcaster with books */
3796 for (j = 0; j < ((use_realm2 > -1) ? 2 : 1); j++)
3800 /* Reset vertical */
3803 /* Vertical location */
3804 y = (j < 3) ? 0 : (m[j - 3] + 2);
3806 /* Horizontal location */
3810 for (i = 0; i < 32; i++)
3812 byte a = TERM_WHITE;
3814 /* Access the spell */
3815 if (!is_magic((j < 1) ? use_realm1 : use_realm2))
3817 s_ptr = &technic_info[(j < 1) ? use_realm1 : use_realm2 - MIN_TECHNIC][i % 32];
3821 s_ptr = &mp_ptr->info[(j < 1) ? use_realm1 : use_realm2][i % 32];
3824 strcpy(name, spell_names[technic2magic((j < 1) ? use_realm1+1 : use_realm2+1)-1][i % 32]);
3827 if (s_ptr->slevel >= 99)
3831 strcpy(name, "(ȽÆÉÉÔǽ)");
3833 strcpy(name, "(illegible)");
3843 ((spell_forgotten1 & (1L << i))) :
3844 ((spell_forgotten2 & (1L << (i % 32)))))
3851 else if (!((j < 1) ?
3852 (spell_learned1 & (1L << i)) :
3853 (spell_learned2 & (1L << (i % 32)))))
3860 else if (!((j < 1) ?
3861 (spell_worked1 & (1L << i)) :
3862 (spell_worked2 & (1L << (i % 32)))))
3868 /* Dump the spell --(-- */
3869 sprintf(out_val, "%c/%c) %-20.20s",
3870 I2A(n / 8), I2A(n % 8), name);
3875 /* Dump onto the window */
3876 Term_putstr(x, m[j], -1, a, out_val);
3887 * Returns spell chance of failure for spell -RAK-
3889 s16b spell_chance(int spell, int realm)
3891 int chance, minfail;
3894 int penalty = (mp_ptr->spell_stat == A_WIS) ? 10 : 4;
3897 /* Paranoia -- must be literate */
3898 if (!mp_ptr->spell_book) return (100);
3900 if (realm+1 == REALM_HISSATSU) return 0;
3902 /* Access the spell */
3903 if (!is_magic(realm+1))
3905 s_ptr = &technic_info[realm - MIN_TECHNIC][spell];
3909 s_ptr = &mp_ptr->info[realm][spell];
3912 /* Extract the base spell failure rate */
3913 chance = s_ptr->sfail;
3915 /* Reduce failure rate by "effective" level adjustment */
3916 chance -= 3 * (p_ptr->lev - s_ptr->slevel);
3918 /* Reduce failure rate by INT/WIS adjustment */
3919 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
3922 chance += (MAX(r_info[m_list[p_ptr->riding].r_idx].level-skill_exp[GINOU_RIDING]/100-10,0));
3924 if (p_ptr->pclass == CLASS_SORCERER)
3925 shouhimana = s_ptr->smana*2200 + 2399;
3926 else if (p_ptr->pclass == CLASS_RED_MAGE)
3927 shouhimana = s_ptr->smana*2600 + 2399;
3928 else if ((realm+1 == p_ptr->realm1) || (realm+1 == p_ptr->realm2))
3929 shouhimana = (s_ptr->smana*(3800-spell_exp[((p_ptr->realm1 == realm+1) ? spell: spell+32)])+2399);
3930 else shouhimana = s_ptr->smana*3800;
3933 else shouhimana *= 4;
3935 if(shouhimana < 1) shouhimana = 1;
3937 /* Not enough mana to cast */
3938 if (shouhimana > p_ptr->csp)
3940 chance += 5 * (shouhimana - p_ptr->csp);
3943 if (p_ptr->pseikaku == SEIKAKU_NAMAKE) chance += 10;
3944 if (p_ptr->pseikaku == SEIKAKU_KIREMONO) chance -= 3;
3945 if ((p_ptr->pseikaku == SEIKAKU_GAMAN) || (p_ptr->pseikaku == SEIKAKU_CHIKARA)) chance++;
3946 if (((realm + 1) != p_ptr->realm1) && ((p_ptr->pclass == CLASS_MAGE) || (p_ptr->pclass == CLASS_PRIEST))) chance += 5;
3948 /* Extract the minimum failure rate */
3949 minfail = adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]];
3952 * Non mage/priest characters never get too good
3953 * (added high mage, mindcrafter)
3955 if (mp_ptr->spell_xtra & MAGIC_FAIL_5PERCENT)
3957 if (minfail < 5) minfail = 5;
3960 /* Hack -- Priest prayer penalty for "edged" weapons -DGK */
3961 if (((p_ptr->pclass == CLASS_PRIEST) || (p_ptr->pclass == CLASS_SORCERER)) && p_ptr->icky_wield[0]) chance += 25;
3962 if (((p_ptr->pclass == CLASS_PRIEST) || (p_ptr->pclass == CLASS_SORCERER)) && p_ptr->icky_wield[1]) chance += 25;
3964 if (p_ptr->heavy_spell) chance += 20;
3965 if(p_ptr->dec_mana && p_ptr->easy_spell) chance-=4;
3966 else if (p_ptr->easy_spell) chance-=3;
3967 else if (p_ptr->dec_mana) chance-=2;
3969 if ((realm+1 == REALM_NATURE) && ((p_ptr->align > 50) || (p_ptr->align < -50))) chance += penalty;
3970 if ((realm+1 == REALM_LIFE) && (p_ptr->align < -20)) chance += penalty;
3971 if (((realm+1 == REALM_DEATH) || (realm+1 == REALM_DAEMON)) && (p_ptr->align > 20)) chance += penalty;
3973 /* Minimum failure rate */
3974 if (chance < minfail) chance = minfail;
3976 /* Stunning makes spells harder */
3977 if (p_ptr->stun > 50) chance += 25;
3978 else if (p_ptr->stun) chance += 15;
3980 /* Always a 5 percent chance of working */
3981 if (chance > 95) chance = 95;
3983 if ((realm+1 == p_ptr->realm1) || (realm+1 == p_ptr->realm2))
3985 if(spell_exp[((p_ptr->realm1 == realm+1) ? spell: spell+32)]>1399) chance--;
3986 if(spell_exp[((p_ptr->realm1 == realm+1) ? spell: spell+32)]>1599) chance--;
3988 if(p_ptr->dec_mana) chance--;
3989 if (p_ptr->heavy_spell) chance += 5;
3991 chance = MAX(chance,0);
3993 /* Return the chance */
4000 * Determine if a spell is "okay" for the player to cast or study
4001 * The spell must be legible, not forgotten, and also, to cast,
4002 * it must be known, and to study, it must not be known.
4004 bool spell_okay(int spell, bool learned, bool study_pray, int realm)
4008 /* Access the spell */
4009 if (!is_magic(realm+1))
4011 s_ptr = &technic_info[realm - MIN_TECHNIC][spell];
4015 s_ptr = &mp_ptr->info[realm][spell];
4018 /* Spell is illegal */
4019 if (s_ptr->slevel > p_ptr->lev) return (FALSE);
4021 /* Spell is forgotten */
4022 if ((realm == p_ptr->realm2 - 1) ?
4023 (spell_forgotten2 & (1L << spell)) :
4024 (spell_forgotten1 & (1L << spell)))
4030 if (p_ptr->pclass == CLASS_SORCERER) return (TRUE);
4031 if (p_ptr->pclass == CLASS_RED_MAGE) return (TRUE);
4033 /* Spell is learned */
4034 if ((realm == p_ptr->realm2 - 1) ?
4035 (spell_learned2 & (1L << spell)) :
4036 (spell_learned1 & (1L << spell)))
4039 return (!study_pray);
4042 /* Okay to study, not to cast */
4049 * Extra information on a spell -DRS-
4051 * We can use up to 14 characters of the buffer 'p'
4053 * The strings in this function were extracted from the code in the
4054 * functions "do_cmd_cast()" and "do_cmd_pray()" and may be dated.
4056 static void spell_info(char *p, int spell, int realm)
4058 int plev = p_ptr->lev;
4061 int orb = plev + (plev / ((p_ptr->pclass == CLASS_PRIEST ||
4062 p_ptr->pclass == CLASS_HIGH_MAGE ||
4063 p_ptr->pclass == CLASS_SORCERER) ? 2 : 4));
4065 int burst = plev + (plev / ((p_ptr->pclass == CLASS_MAGE ||
4066 p_ptr->pclass == CLASS_HIGH_MAGE ||
4067 p_ptr->pclass == CLASS_SORCERER) ? 2 : 4));
4069 cptr s_dam = "»½ý:";
4070 cptr s_dur = "´ü´Ö:";
4071 cptr s_range = "ÈÏ°Ï:";
4072 cptr s_heal = "²óÉü:";
4073 cptr s_random = "¥é¥ó¥À¥à";
4074 cptr s_delay = "ÃÙ±ä:";
4076 cptr s_dam = "dam ";
4077 cptr s_dur = "dur ";
4078 cptr s_range = "range ";
4079 cptr s_heal = "heal ";
4080 cptr s_random = "random";
4081 cptr s_delay = "delay ";
4086 /* Analyze the spell */
4092 case 1: sprintf(p, " %s2d10", s_heal); break;
4093 case 2: sprintf(p, " %s12+d12", s_dur); break;
4094 case 4: sprintf(p, " %s%d", s_dam, 10 + (plev / 2)); break;
4095 case 6: sprintf(p, " %s4d10", s_heal); break;
4096 case 10: sprintf(p, " %s8d10", s_heal); break;
4097 case 11: sprintf(p, " %s24+d24", s_dur); break;
4098 case 12: sprintf(p, " %s3d6+%d", s_dam, orb); break;
4099 case 13: sprintf(p, " %sd25+%d", s_dur, 3 * plev); break;
4100 case 14: sprintf(p, " %s300", s_heal); break;
4101 case 16: sprintf(p, " %sd%d", s_dam, plev); break;
4102 case 18: sprintf(p, " %sd%d", s_dam, 3 * plev); break;
4103 case 20: sprintf(p, " %sd%d", s_dam, 4 * plev); break;
4105 case 22: sprintf(p, " »:d%d/²ó:1000", 4 * plev); break;
4107 case 22: sprintf(p, " d %d/h 1000", 4 * plev); break;
4109 case 24: sprintf(p, " %s25+d25", s_dur); break;
4110 case 25: sprintf(p, " %s48+d48", s_dur); break;
4111 case 28: sprintf(p, " %s2000", s_heal); break;
4113 case 30: sprintf(p, " ²ó300/»%d+250", plev * 4); break;
4115 case 30: sprintf(p, " h300/d%d+250", plev * 4); break;
4117 case 31: sprintf(p, " %s%d+d%d", s_dur,(plev/2), (plev/2)); break;
4121 case 1: /* Sorcery */
4124 case 1: sprintf(p, " %s10", s_range); break;
4125 case 3: sprintf(p, " %s%d", s_dam, 10 + (plev / 2)); break;
4126 case 5: sprintf(p, " %s%d", s_range, plev * 5); break;
4127 case 13: sprintf(p, " %s%d+d%d", s_dur, plev, plev + 20); break;
4128 case 18: sprintf(p, " %s25+d30", s_dur); break;
4129 case 22: sprintf(p, " %s15+d21", s_delay); break;
4130 case 23: sprintf(p, " %s%d", s_range, plev / 2 + 10); break;
4131 case 25: sprintf(p, " %s7d7+%d", s_dam, plev); break;
4133 case 26: sprintf(p, " ºÇÂç½ÅÎÌ:%d.%dkg", lbtokg1(plev * 15),lbtokg2(plev * 15)); break;
4135 case 26: sprintf(p, " max wgt %d", plev * 15 / 10); break;
4137 case 27: sprintf(p, " %s25+d30", s_dur); break;
4138 case 31: sprintf(p, " %s4+d4", s_dur); break;
4142 case 2: /* Nature */
4146 case 1: sprintf(p, " %s%dd4 ¼ÍÄø%d", s_dam, (3 + ((plev - 1) / 5)), plev/6+2); break;
4148 case 1: sprintf(p, " %s%dd4 rng %d", s_dam, (3 + ((plev - 1) / 5)), plev/6+2); break;
4150 case 4: sprintf(p, " %s%d", s_dam, 10 + (plev / 2)); break;
4151 case 6: sprintf(p, " %s20+d20", s_dur); break;
4152 case 7: sprintf(p, " %s2d8", s_heal); break;
4153 case 9: sprintf(p, " %s%dd8", s_dam, (3 + ((plev - 5) / 4))); break;
4154 case 11: sprintf(p, " %s%dd8", s_dam, (5 + ((plev - 5) / 4))); break;
4155 case 12: sprintf(p, " %s6d8", s_dam); break;
4156 case 15: sprintf(p, " %s500", s_heal); break;
4157 case 17: sprintf(p, " %s20+d30", s_dur); break;
4158 case 18: sprintf(p, " %s20+d20", s_dur); break;
4160 case 24: sprintf(p, " Ⱦ·Â:10"); break;
4162 case 24: sprintf(p, " rad 10"); break;
4164 case 26: sprintf(p, " %s%d", s_dam, 70 + plev * 3 / 2); break;
4165 case 27: sprintf(p, " %s%d", s_dam, 90 + plev * 3 / 2); break;
4166 case 28: sprintf(p, " %s%d", s_dam, 100 + plev * 3 / 2); break;
4167 case 29: sprintf(p, " %s75", s_dam); break;
4168 case 31: sprintf(p, " %s%d+%d", s_dam, 4 * plev, 100 + plev); break;
4175 case 0: sprintf(p, " %s%dd4", s_dam, 3 + ((plev - 1) / 5)); break;
4176 case 2: sprintf(p, " %s%d", s_dam, 10 + (plev / 2)); break;
4177 case 4: sprintf(p, " %s3d5+%d", s_dam, burst); break;
4178 case 5: sprintf(p, " %s%dd8", s_dam, (6 + ((plev - 5) / 4))); break;
4179 case 6: sprintf(p, " %s%dd8", s_dam, (8 + ((plev - 5) / 4))); break;
4180 case 7: sprintf(p, " %s%d", s_range, plev * 5); break;
4181 case 8: sprintf(p, " %s", s_random); break;
4182 case 9: sprintf(p, " %s%dd8", s_dam, (10 + ((plev - 5) / 4))); break;
4183 case 10: sprintf(p, " %s%d", s_dam, (60 + plev)/2); break;
4184 case 11: sprintf(p, " %s%dd8", s_dam, (11 + ((plev - 5) / 4))); break;
4185 case 12: sprintf(p, " %s%d", s_dam, 55 + plev); break;
4186 case 15: sprintf(p, " %s%d", s_dam, 99 + plev*2); break;
4187 case 17: sprintf(p, " %s%dd8", s_dam, (5 + (plev / 10))); break;
4188 case 19: sprintf(p, " %s%d", s_dam, 70 + plev); break;
4189 case 21: sprintf(p, " %s%d", s_dam, 120 + plev*2); break;
4190 case 24: sprintf(p, " %s%dd8", s_dam, (9 + (plev / 10))); break;
4192 case 25: sprintf(p, " %s³Æ%d", s_dam, plev * 2); break;
4194 case 25: sprintf(p, " dam %d each", plev * 2); break;
4196 case 26: sprintf(p, " %s%d", s_dam, 150 + plev*3/2); break;
4197 case 27: sprintf(p, " %s150 / 250", s_dam); break;
4198 case 29: sprintf(p, " %s%d", s_dam, 300 + (plev * 4)); break;
4199 case 30: sprintf(p, " %s%d", s_dam, p_ptr->chp); break;
4200 case 31: sprintf(p, " %s3 * 175", s_dam); break;
4207 case 1: sprintf(p, " %s%dd3", s_dam, (3 + ((plev - 1) / 5))); break;
4208 case 3: sprintf(p, " %s%d", s_dam, 10 + (plev / 2)); break;
4209 case 5: sprintf(p, " %s20+d20", s_dur); break;
4210 case 8: sprintf(p, " %s3d6+%d", s_dam, burst); break;
4211 case 9: sprintf(p, " %s%dd8", s_dam, (8 + ((plev - 5) / 4))); break;
4212 case 10: sprintf(p, " %s%d", s_dam, 30+plev); break;
4214 case 13: sprintf(p, " »:%d+d%d", plev * 2, plev * 2); break;
4216 case 13: sprintf(p, " d %d+d%d", plev * 2, plev * 2); break;
4218 case 16: sprintf(p, " %s25+d25", s_dur); break;
4219 case 17: sprintf(p, " %s", s_random); break;
4220 case 18: sprintf(p, " %s%dd8", s_dam, (4 + ((plev - 5) / 4))); break;
4221 case 19: sprintf(p, " %s25+d25", s_dur); break;
4222 case 21: sprintf(p, " %s3*100", s_dam); break;
4223 case 22: sprintf(p, " %sd%d", s_dam, plev * 3); break;
4224 case 23: sprintf(p, " %s%d", s_dam, 100 + plev * 2); break;
4225 case 27: sprintf(p, " %s%d+d%d", s_dur,10+plev/2, 10+plev/2); break;
4226 case 30: sprintf(p, " %s666", s_dam); break;
4227 case 31: sprintf(p, " %s%d+d%d", s_dur, (plev / 2), (plev / 2)); break;
4234 case 0: sprintf(p, " %s10", s_range); break;
4235 case 2: sprintf(p, " %s", s_random); break;
4236 case 4: sprintf(p, " %s%d", s_range, plev * 4); break;
4237 case 5: sprintf(p, " %s25+d30", s_dur); break;
4239 case 8: sprintf(p, " ºÇÂç½ÅÎÌ:%d.%d", lbtokg1(plev * 15 / 10),lbtokg2(plev * 15 / 10)); break;
4241 case 8: sprintf(p, " max wgt %d", plev * 15 / 10); break;
4243 case 13: sprintf(p, " %s%d", s_range, plev / 2 + 10); break;
4244 case 14: sprintf(p, " %s15+d21", s_delay); break;
4245 case 26: sprintf(p, " %s%d", s_heal, plev * 10 + 200); break;
4247 case 28: sprintf(p, " %s³Æ%d", s_dam, plev * 2); break;
4249 case 28: sprintf(p, " dam %d each", plev * 2); break;
4254 case 6: /* Arcane */
4257 case 0: sprintf(p, " %s%dd3", s_dam, 3 + ((plev - 1) / 5)); break;
4258 case 4: sprintf(p, " %s10", s_range); break;
4259 case 5: sprintf(p, " %s2d%d", s_dam, plev / 2); break;
4260 case 7: sprintf(p, " %s2d8", s_heal); break;
4264 case 17: sprintf(p, " %s20+d20", s_dur); break;
4265 case 18: sprintf(p, " %s4d8", s_heal); break;
4266 case 19: sprintf(p, " %s%d", s_range, plev * 5); break;
4267 case 21: sprintf(p, " %s6d8", s_dam); break;
4268 case 24: sprintf(p, " %s24+d24", s_dur); break;
4269 case 28: sprintf(p, " %s%d", s_dam, 75 + plev); break;
4270 case 30: sprintf(p, " %s15+d21", s_delay); break;
4271 case 31: sprintf(p, " %s25+d30", s_dur); break;
4278 case 0: sprintf(p, " %s100+d100", s_dur); break;
4279 case 1: sprintf(p, " %s80+d80", s_dur); break;
4285 case 18: sprintf(p, " %s20+d20", s_dur); break;
4286 case 5: sprintf(p, " %s25+d25", s_dur); break;
4287 case 8: sprintf(p, " %s24+d24", s_dur); break;
4288 case 11: sprintf(p, " %s25+d25", s_dur); break;
4289 case 13: sprintf(p, " %s%d+d25", s_dur, plev * 3); break;
4290 case 15: sprintf(p, " %s%d+d%d", s_dur, plev/2, plev/2); break;
4291 case 16: sprintf(p, " %s25+d30", s_dur); break;
4292 case 17: sprintf(p, " %s30+d20", s_dur); break;
4293 case 19: sprintf(p, " %s%d+d%d", s_dur, plev+20, plev); break;
4294 case 20: sprintf(p, " %s50+d50", s_dur); break;
4295 case 23: sprintf(p, " %s20+d20", s_dur); break;
4296 case 31: sprintf(p, " %s13+d13", s_dur); break;
4300 case 8: /* Daemon */
4303 case 0: sprintf(p, " %s%dd4", s_dam, 3 + ((plev - 1) / 5)); break;
4304 case 2: sprintf(p, " %s12+d12", s_dur); break;
4305 case 3: sprintf(p, " %s20+d20", s_dur); break;
4306 case 5: sprintf(p, " %s%dd8", s_dam, (6 + ((plev - 5) / 4))); break;
4307 case 7: sprintf(p, " %s3d6+%d", s_dam, burst); break;
4308 case 10: sprintf(p, " %s20+d20", s_dur); break;
4309 case 11: sprintf(p, " %s%dd8", s_dam, (11 + ((plev - 5) / 4))); break;
4310 case 12: sprintf(p, " %s%d", s_dam, 55 + plev); break;
4311 case 14: sprintf(p, " %s%d", s_dam, 100 + plev*3/2); break;
4312 case 16: sprintf(p, " %s30+d25", s_dur); break;
4313 case 17: sprintf(p, " %s20+d20", s_dur); break;
4314 case 18: sprintf(p, " %s%d", s_dam, 55 + plev); break;
4315 case 19: sprintf(p, " %s%d", s_dam, 80 + plev*3/2); break;
4316 case 20: sprintf(p, " %s%d+d%d", s_dur,10+plev/2, 10+plev/2); break;
4317 case 21: sprintf(p, " %sd%d+d%d", s_dam, 2 * plev, 2 * plev); break;
4318 case 22: sprintf(p, " %s%d", s_dam, 100 + plev*2); break;
4319 case 24: sprintf(p, " %s25+d25", s_dur); break;
4320 case 25: sprintf(p, " %s20+d20", s_dur); break;
4321 case 26: sprintf(p, " %s%d+%d", s_dam, 25+plev/2, 25+plev/2); break;
4322 case 29: sprintf(p, " %s%d", s_dam, plev*15); break;
4323 case 30: sprintf(p, " %s600", s_dam); break;
4324 case 31: sprintf(p, " %s15+d15", s_dur); break;
4328 case 15: /* Music */
4331 case 2 : sprintf(p, " %s%dd4", s_dam, 4 + ((plev - 1) / 5)); break;
4332 case 4 : sprintf(p, " %s2d6", s_heal); break;
4333 case 9 : sprintf(p, " %sd%d", s_dam, plev * 3 / 2); break;
4334 case 13: sprintf(p, " %s%dd7", s_dam, 10 + (plev / 5)); break;
4335 case 20: sprintf(p, " %sd%d+d%d", s_dam, plev * 3, plev * 3); break;
4336 case 22: sprintf(p, " %s%dd10", s_dam, 15 + ((plev - 1) / 2)); break;
4337 case 27: sprintf(p, " %sd%d", s_dam, plev * 3); break;
4338 case 28: sprintf(p, " %s15d10", s_heal); break;
4339 case 30: sprintf(p, " %s%dd10", s_dam, 50 + plev); break;
4344 sprintf(p, "̤ÃΤΥ¿¥¤¥×: %d", realm);
4346 sprintf(p, "Unknown type: %d.", realm);
4353 * Print a list of spells (for browsing or casting or viewing)
4355 void print_spells(int target_spell, byte *spells, int num, int y, int x, int realm)
4357 int i, spell, shougou, increment = 64;
4369 if (((realm < 0) || (realm > MAX_REALM - 1)) && wizard)
4371 msg_print("·Ù¹ð¡ª print_spell ¤¬Îΰè¤Ê¤·¤Ë¸Æ¤Ð¤ì¤¿");
4373 msg_print("Warning! print_spells called with null realm");
4377 /* Title the list */
4379 if (realm+1 == REALM_HISSATSU)
4381 strcpy(buf," Lv MP");
4383 strcpy(buf," Lv SP");
4387 strcpy(buf,"½ÏÎýÅÙ Lv MP ¼ºÎ¨ ¸ú²Ì");
4389 strcpy(buf,"Profic Lv SP Fail Effect");
4393 put_str("̾Á°", y, x + 5);
4394 put_str(buf, y, x + 29);
4396 put_str("Name", y, x + 5);
4397 put_str(buf, y, x + 29);
4400 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE)) increment = 0;
4401 else if ((realm + 1) == p_ptr->realm1) increment = 0;
4402 else if ((realm + 1) == p_ptr->realm2) increment = 32;
4404 /* Dump the spells */
4405 for (i = 0; i < num; i++)
4407 /* Access the spell */
4410 /* Access the spell */
4411 if (!is_magic(realm+1))
4413 s_ptr = &technic_info[realm - MIN_TECHNIC][spell];
4417 s_ptr = &mp_ptr->info[realm][spell];
4420 if (realm+1 == REALM_HISSATSU)
4421 shouhimana = s_ptr->smana;
4424 if (p_ptr->pclass == CLASS_SORCERER)
4425 shouhimana = s_ptr->smana*2200 + 2399;
4426 else if (p_ptr->pclass == CLASS_RED_MAGE)
4427 shouhimana = s_ptr->smana*2600 + 2399;
4428 else if ((realm+1 == p_ptr->realm1) || (realm+1 == p_ptr->realm2))
4429 shouhimana = (s_ptr->smana*(3800-spell_exp[(spell+increment)])+2399);
4431 shouhimana = s_ptr->smana*3800+2399;
4434 else shouhimana *= 4;
4436 if(shouhimana < 1) shouhimana = 1;
4439 if ((increment == 64) || (s_ptr->slevel >= 99)) shougou = 0;
4440 else if (spell_exp[spell+increment]<900) shougou = 0;
4441 else if (spell_exp[spell+increment]<1200) shougou = 1;
4442 else if (spell_exp[spell+increment]<1400) shougou = 2;
4443 else if (spell_exp[spell+increment]<1600) shougou = 3;
4446 if (!increment && (shougou == 4)) max = TRUE;
4447 else if ((increment == 32) && (shougou == 3)) max = TRUE;
4448 else if (s_ptr->slevel >= 99) max = TRUE;
4449 else if (p_ptr->pclass == CLASS_RED_MAGE) max = TRUE;
4451 strncpy(ryakuji,shougou_moji[shougou],4);
4455 if (use_menu && target_spell)
4457 if (i == (target_spell-1))
4459 strcpy(out_val, " ¡Õ ");
4461 strcpy(out_val, " > ");
4464 strcpy(out_val, " ");
4466 else sprintf(out_val, " %c) ", I2A(i));
4467 /* Skip illegible spells */
4468 if (s_ptr->slevel >= 99)
4471 strcat(out_val, format("%-30s", "(ȽÆÉÉÔǽ)"));
4473 strcat(out_val, format("%-30s", "(illegible)"));
4476 c_prt(TERM_L_DARK, out_val, y + i + 1, x);
4480 /* XXX XXX Could label spells above the players level */
4482 /* Get extra info */
4483 spell_info(info, spell, realm);
4488 /* Assume spell is known and tried */
4489 line_attr = TERM_WHITE;
4491 /* Analyze the spell */
4492 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4494 if (s_ptr->slevel > p_ptr->max_plv)
4499 comment = " unknown";
4502 line_attr = TERM_L_BLUE;
4504 else if (s_ptr->slevel > p_ptr->lev)
4509 comment = " forgotten";
4512 line_attr = TERM_YELLOW;
4515 else if ((realm+1 != p_ptr->realm1) && (realm+1 != p_ptr->realm2))
4520 comment = " unknown";
4523 line_attr = TERM_L_BLUE;
4525 else if ((realm + 1 == p_ptr->realm1) ?
4526 ((spell_forgotten1 & (1L << spell))) :
4527 ((spell_forgotten2 & (1L << spell))))
4532 comment = " forgotten";
4535 line_attr = TERM_YELLOW;
4537 else if (!((realm + 1 == p_ptr->realm1) ?
4538 (spell_learned1 & (1L << spell)) :
4539 (spell_learned2 & (1L << spell))))
4544 comment = " unknown";
4547 line_attr = TERM_L_BLUE;
4549 else if (!((realm + 1 == p_ptr->realm1) ?
4550 (spell_worked1 & (1L << spell)) :
4551 (spell_worked2 & (1L << spell))))
4554 comment = " ̤·Ð¸³";
4556 comment = " untried";
4559 line_attr = TERM_L_GREEN;
4562 /* Dump the spell --(-- */
4563 if (realm+1 == REALM_HISSATSU)
4565 strcat(out_val, format("%-25s %2d %4d",
4566 spell_names[technic2magic(realm+1)-1][spell], /* realm, spell */
4567 s_ptr->slevel, shouhimana));
4571 strcat(out_val, format("%-25s%c%-4s %2d %4d %3d%%%s",
4572 spell_names[technic2magic(realm+1)-1][spell], /* realm, spell */
4573 (max ? '!' : ' '), ryakuji,
4574 s_ptr->slevel, shouhimana, spell_chance(spell, realm), comment));
4576 c_prt(line_attr, out_val, y + i + 1, x);
4579 /* Clear the bottom line */
4580 prt("", y + i + 1, x);
4585 * Note that amulets, rods, and high-level spell books are immune
4586 * to "inventory damage" of any kind. Also sling ammo and shovels.
4591 * Does a given class of objects (usually) hate acid?
4592 * Note that acid can either melt or corrode something.
4594 bool hates_acid(object_type *o_ptr)
4596 /* Analyze the type */
4597 switch (o_ptr->tval)
4599 /* Wearable items */
4619 /* Staffs/Scrolls are wood/paper */
4632 /* Junk is useless */
4646 * Does a given object (usually) hate electricity?
4648 bool hates_elec(object_type *o_ptr)
4650 switch (o_ptr->tval)
4664 * Does a given object (usually) hate fire?
4665 * Hafted/Polearm weapons have wooden shafts.
4666 * Arrows/Bows are mostly wooden.
4668 bool hates_fire(object_type *o_ptr)
4670 /* Analyze the type */
4671 switch (o_ptr->tval)
4689 case TV_SORCERY_BOOK:
4690 case TV_NATURE_BOOK:
4694 case TV_ARCANE_BOOK:
4695 case TV_ENCHANT_BOOK:
4696 case TV_DAEMON_BOOK:
4698 case TV_HISSATSU_BOOK:
4709 /* Staffs/Scrolls burn */
4722 * Does a given object (usually) hate cold?
4724 bool hates_cold(object_type *o_ptr)
4726 switch (o_ptr->tval)
4743 int set_acid_destroy(object_type *o_ptr)
4746 if (!hates_acid(o_ptr)) return (FALSE);
4747 object_flags(o_ptr, &f1, &f2, &f3);
4748 if (f3 & TR3_IGNORE_ACID) return (FALSE);
4756 int set_elec_destroy(object_type *o_ptr)
4759 if (!hates_elec(o_ptr)) return (FALSE);
4760 object_flags(o_ptr, &f1, &f2, &f3);
4761 if (f3 & TR3_IGNORE_ELEC) return (FALSE);
4769 int set_fire_destroy(object_type *o_ptr)
4772 if (!hates_fire(o_ptr)) return (FALSE);
4773 object_flags(o_ptr, &f1, &f2, &f3);
4774 if (f3 & TR3_IGNORE_FIRE) return (FALSE);
4782 int set_cold_destroy(object_type *o_ptr)
4785 if (!hates_cold(o_ptr)) return (FALSE);
4786 object_flags(o_ptr, &f1, &f2, &f3);
4787 if (f3 & TR3_IGNORE_COLD) return (FALSE);
4793 * Destroys a type of item on a given percent chance
4794 * Note that missiles are no longer necessarily all destroyed
4795 * Destruction taken from "melee.c" code for "stealing".
4796 * New-style wands and rods handled correctly. -LM-
4797 * Returns number of items destroyed.
4799 int inven_damage(inven_func typ, int perc)
4803 char o_name[MAX_NLEN];
4805 /* Multishadow effects is determined by turn */
4806 if( p_ptr->multishadow && (turn & 1) )return 0;
4808 if (p_ptr->inside_arena) return 0;
4810 /* Count the casualties */
4813 /* Scan through the slots backwards */
4814 for (i = 0; i < INVEN_PACK; i++)
4816 o_ptr = &inventory[i];
4818 /* Skip non-objects */
4819 if (!o_ptr->k_idx) continue;
4821 /* Hack -- for now, skip artifacts */
4822 if (artifact_p(o_ptr) || o_ptr->art_name) continue;
4824 /* Give this item slot a shot at death */
4827 /* Count the casualties */
4828 for (amt = j = 0; j < o_ptr->number; ++j)
4830 if (rand_int(100) < perc) amt++;
4833 /* Some casualities */
4836 /* Get a description */
4837 object_desc(o_name, o_ptr, FALSE, 3);
4841 msg_format("%s(%c)¤¬%s²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª",
4843 msg_format("%sour %s (%c) %s destroyed!",
4847 o_name, index_to_label(i),
4848 ((o_ptr->number > 1) ?
4849 ((amt == o_ptr->number) ? "Á´Éô" :
4850 (amt > 1 ? "²¿¸Ä¤«" : "°ì¸Ä")) : "") );
4852 ((o_ptr->number > 1) ?
4853 ((amt == o_ptr->number) ? "All of y" :
4854 (amt > 1 ? "Some of y" : "One of y")) : "Y"),
4855 o_name, index_to_label(i),
4856 ((amt > 1) ? "were" : "was"));
4860 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
4861 msg_print("¤ä¤ê¤ä¤¬¤Ã¤¿¤Ê¡ª");
4864 /* Potions smash open */
4865 if (object_is_potion(o_ptr))
4867 (void)potion_smash_effect(0, py, px, o_ptr->k_idx);
4870 /* Reduce the charges of rods/wands */
4871 reduce_charges(o_ptr, amt);
4873 /* Destroy "amt" items */
4874 inven_item_increase(i, -amt);
4875 inven_item_optimize(i);
4877 /* Count the casualties */
4883 /* Return the casualty count */
4889 * Acid has hit the player, attempt to affect some armor.
4891 * Note that the "base armor" of an object never changes.
4893 * If any armor is damaged (or resists), the player takes less damage.
4895 static int minus_ac(void)
4897 object_type *o_ptr = NULL;
4899 char o_name[MAX_NLEN];
4902 /* Pick a (possibly empty) inventory slot */
4905 case 1: o_ptr = &inventory[INVEN_RARM]; break;
4906 case 2: o_ptr = &inventory[INVEN_LARM]; break;
4907 case 3: o_ptr = &inventory[INVEN_BODY]; break;
4908 case 4: o_ptr = &inventory[INVEN_OUTER]; break;
4909 case 5: o_ptr = &inventory[INVEN_HANDS]; break;
4910 case 6: o_ptr = &inventory[INVEN_HEAD]; break;
4911 case 7: o_ptr = &inventory[INVEN_FEET]; break;
4914 /* Nothing to damage */
4915 if (!o_ptr->k_idx) return (FALSE);
4917 if (o_ptr->tval < TV_BOOTS) return (FALSE);
4919 /* No damage left to be done */
4920 if (o_ptr->ac + o_ptr->to_a <= 0) return (FALSE);
4924 object_desc(o_name, o_ptr, FALSE, 0);
4926 /* Extract the flags */
4927 object_flags(o_ptr, &f1, &f2, &f3);
4929 /* Object resists */
4930 if (f3 & TR3_IGNORE_ACID)
4933 msg_format("¤·¤«¤·%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª", o_name);
4935 msg_format("Your %s is unaffected!", o_name);
4944 msg_format("%s¤¬¥À¥á¡¼¥¸¤ò¼õ¤±¤¿¡ª", o_name);
4946 msg_format("Your %s is damaged!", o_name);
4950 /* Damage the item */
4953 /* Calculate bonuses */
4954 p_ptr->update |= (PU_BONUS);
4957 p_ptr->window |= (PW_EQUIP | PW_PLAYER);
4961 /* Item was damaged */
4967 * Hurt the player with Acid
4969 void acid_dam(int dam, cptr kb_str, int monspell)
4971 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
4972 bool double_resist = (p_ptr->oppose_acid || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
4974 /* Total Immunity */
4975 if (p_ptr->immune_acid || (dam <= 0))
4977 learn_spell(monspell);
4981 /* Vulnerability (Ouch!) */
4982 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
4983 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
4985 /* Resist the damage */
4986 if (p_ptr->resist_acid) dam = (dam + 2) / 3;
4987 if (double_resist) dam = (dam + 2) / 3;
4989 if ((!(double_resist || p_ptr->resist_acid)) &&
4990 randint(HURT_CHANCE) == 1)
4991 (void)do_dec_stat(A_CHR);
4993 /* If any armor gets hit, defend the player */
4994 if (minus_ac()) dam = (dam + 1) / 2;
4997 take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
4999 /* Inventory damage */
5000 if (!(double_resist && p_ptr->resist_acid))
5001 inven_damage(set_acid_destroy, inv);
5006 * Hurt the player with electricity
5008 void elec_dam(int dam, cptr kb_str, int monspell)
5010 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
5011 bool double_resist = (p_ptr->oppose_elec || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
5013 /* Total immunity */
5014 if (p_ptr->immune_elec || (dam <= 0))
5016 learn_spell(monspell);
5020 /* Vulnerability (Ouch!) */
5021 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
5022 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
5023 if (p_ptr->prace == RACE_ANDROID) dam += dam / 3;
5025 /* Resist the damage */
5026 if (p_ptr->resist_elec) dam = (dam + 2) / 3;
5027 if (double_resist) dam = (dam + 2) / 3;
5029 if ((!(double_resist || p_ptr->resist_elec)) &&
5030 randint(HURT_CHANCE) == 1)
5031 (void)do_dec_stat(A_DEX);
5034 take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
5036 /* Inventory damage */
5037 if (!(double_resist && p_ptr->resist_elec))
5038 inven_damage(set_elec_destroy, inv);
5043 * Hurt the player with Fire
5045 void fire_dam(int dam, cptr kb_str, int monspell)
5047 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
5048 bool double_resist = (p_ptr->oppose_fire || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
5050 /* Totally immune */
5051 if (p_ptr->immune_fire || (dam <= 0))
5053 learn_spell(monspell);
5057 /* Vulnerability (Ouch!) */
5058 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
5059 if (prace_is_(RACE_ENT)) dam += dam / 3;
5060 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
5062 /* Resist the damage */
5063 if (p_ptr->resist_fire) dam = (dam + 2) / 3;
5064 if (double_resist) dam = (dam + 2) / 3;
5066 if ((!(double_resist || p_ptr->resist_fire)) &&
5067 randint(HURT_CHANCE) == 1)
5068 (void)do_dec_stat(A_STR);
5071 take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
5073 /* Inventory damage */
5074 if (!(double_resist && p_ptr->resist_fire))
5075 inven_damage(set_fire_destroy, inv);
5080 * Hurt the player with Cold
5082 void cold_dam(int dam, cptr kb_str, int monspell)
5084 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
5085 bool double_resist = (p_ptr->oppose_cold || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
5087 /* Total immunity */
5088 if (p_ptr->immune_cold || (dam <= 0))
5090 learn_spell(monspell);
5094 /* Vulnerability (Ouch!) */
5095 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
5096 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
5098 /* Resist the damage */
5099 if (p_ptr->resist_cold) dam = (dam + 2) / 3;
5100 if (double_resist) dam = (dam + 2) / 3;
5102 if ((!(double_resist || p_ptr->resist_cold)) &&
5103 randint(HURT_CHANCE) == 1)
5104 (void)do_dec_stat(A_STR);
5107 take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
5109 /* Inventory damage */
5110 if (!(double_resist && p_ptr->resist_cold))
5111 inven_damage(set_cold_destroy, inv);
5115 bool rustproof(void)
5119 char o_name[MAX_NLEN];
5122 item_tester_no_ryoute = TRUE;
5123 /* Select a piece of armour */
5124 item_tester_hook = item_tester_hook_armour;
5128 q = "¤É¤ÎËɶñ¤Ë»¬»ß¤á¤ò¤·¤Þ¤¹¤«¡©";
5129 s = "»¬»ß¤á¤Ç¤¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
5131 q = "Rustproof which piece of armour? ";
5132 s = "You have nothing to rustproof.";
5135 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return FALSE;
5137 /* Get the item (in the pack) */
5140 o_ptr = &inventory[item];
5143 /* Get the item (on the floor) */
5146 o_ptr = &o_list[0 - item];
5151 object_desc(o_name, o_ptr, FALSE, 0);
5153 o_ptr->art_flags3 |= TR3_IGNORE_ACID;
5155 if ((o_ptr->to_a < 0) && !(o_ptr->ident & IDENT_CURSED))
5158 msg_format("%s¤Ï¿·ÉÊƱÍͤˤʤä¿¡ª",o_name);
5160 msg_format("%s %s look%s as good as new!",
5161 ((item >= 0) ? "Your" : "The"), o_name,
5162 ((o_ptr->number > 1) ? "" : "s"));
5169 msg_format("%s¤ÏÉå¿©¤·¤Ê¤¯¤Ê¤Ã¤¿¡£", o_name);
5171 msg_format("%s %s %s now protected against corrosion.",
5172 ((item >= 0) ? "Your" : "The"), o_name,
5173 ((o_ptr->number > 1) ? "are" : "is"));
5184 * Curse the players armor
5186 bool curse_armor(void)
5190 char o_name[MAX_NLEN];
5193 /* Curse the body armor */
5194 o_ptr = &inventory[INVEN_BODY];
5196 /* Nothing to curse */
5197 if (!o_ptr->k_idx) return (FALSE);
5201 object_desc(o_name, o_ptr, FALSE, 3);
5203 /* Attempt a saving throw for artifacts */
5204 if ((o_ptr->art_name || artifact_p(o_ptr)) && (rand_int(100) < 50))
5208 msg_format("%s¤¬%s¤òÊñ¤ß¹þ¤â¤¦¤È¤·¤¿¤¬¡¢%s¤Ï¤½¤ì¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
5209 "¶²ÉݤΰŹõ¥ª¡¼¥é", "Ëɶñ", o_name);
5211 msg_format("A %s tries to %s, but your %s resists the effects!",
5212 "terrible black aura", "surround your armor", o_name);
5217 /* not artifact or failed save... */
5222 msg_format("¶²ÉݤΰŹõ¥ª¡¼¥é¤¬¤¢¤Ê¤¿¤Î%s¤òÊñ¤ß¹þ¤ó¤À¡ª", o_name);
5224 msg_format("A terrible black aura blasts your %s!", o_name);
5227 chg_virtue(V_ENCHANT, -5);
5229 /* Blast the armor */
5231 o_ptr->name2 = EGO_BLASTED;
5232 o_ptr->to_a = 0 - randint(5) - randint(5);
5238 o_ptr->art_flags1 = 0;
5239 o_ptr->art_flags2 = 0;
5240 o_ptr->art_flags3 = 0;
5243 o_ptr->ident |= (IDENT_CURSED);
5246 o_ptr->ident |= (IDENT_BROKEN);
5248 /* Recalculate bonuses */
5249 p_ptr->update |= (PU_BONUS);
5251 /* Recalculate mana */
5252 p_ptr->update |= (PU_MANA);
5255 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
5263 * Curse the players weapon
5265 bool curse_weapon(bool force, int slot)
5269 char o_name[MAX_NLEN];
5272 /* Curse the weapon */
5273 o_ptr = &inventory[slot];
5275 /* Nothing to curse */
5276 if (!o_ptr->k_idx) return (FALSE);
5280 object_desc(o_name, o_ptr, FALSE, 3);
5282 /* Attempt a saving throw */
5283 if ((artifact_p(o_ptr) || o_ptr->art_name) && (rand_int(100) < 50) && !force)
5287 msg_format("%s¤¬%s¤òÊñ¤ß¹þ¤â¤¦¤È¤·¤¿¤¬¡¢%s¤Ï¤½¤ì¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
5288 "¶²ÉݤΰŹõ¥ª¡¼¥é", "Éð´ï", o_name);
5290 msg_format("A %s tries to %s, but your %s resists the effects!",
5291 "terrible black aura", "surround your weapon", o_name);
5296 /* not artifact or failed save... */
5301 if (!force) msg_format("¶²ÉݤΰŹõ¥ª¡¼¥é¤¬¤¢¤Ê¤¿¤Î%s¤òÊñ¤ß¹þ¤ó¤À¡ª", o_name);
5303 if (!force) msg_format("A terrible black aura blasts your %s!", o_name);
5306 chg_virtue(V_ENCHANT, -5);
5308 /* Shatter the weapon */
5310 o_ptr->name2 = EGO_SHATTERED;
5311 o_ptr->to_h = 0 - randint(5) - randint(5);
5312 o_ptr->to_d = 0 - randint(5) - randint(5);
5317 o_ptr->art_flags1 = 0;
5318 o_ptr->art_flags2 = 0;
5319 o_ptr->art_flags3 = 0;
5323 o_ptr->ident |= (IDENT_CURSED);
5326 o_ptr->ident |= (IDENT_BROKEN);
5328 /* Recalculate bonuses */
5329 p_ptr->update |= (PU_BONUS);
5331 /* Recalculate mana */
5332 p_ptr->update |= (PU_MANA);
5335 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
5344 * Enchant some bolts
5346 bool brand_bolts(void)
5350 /* Use the first acceptable bolts */
5351 for (i = 0; i < INVEN_PACK; i++)
5353 object_type *o_ptr = &inventory[i];
5355 /* Skip non-bolts */
5356 if (o_ptr->tval != TV_BOLT) continue;
5358 /* Skip artifacts and ego-items */
5359 if (o_ptr->art_name || artifact_p(o_ptr) || ego_item_p(o_ptr))
5362 /* Skip cursed/broken items */
5363 if (cursed_p(o_ptr) || broken_p(o_ptr)) continue;
5366 if (rand_int(100) < 75) continue;
5370 msg_print("¥¯¥í¥¹¥Ü¥¦¤ÎÌ𤬱ê¤Î¥ª¡¼¥é¤ËÊñ¤Þ¤ì¤¿¡ª");
5372 msg_print("Your bolts are covered in a fiery aura!");
5377 o_ptr->name2 = EGO_FLAME;
5380 enchant(o_ptr, rand_int(3) + 4, ENCH_TOHIT | ENCH_TODAM);
5387 if (flush_failure) flush();
5391 msg_print("±ê¤Ç¶¯²½¤¹¤ë¤Î¤Ë¼ºÇÔ¤·¤¿¡£");
5393 msg_print("The fiery enchantment failed.");
5403 * Helper function -- return a "nearby" race for polymorphing
5405 * Note that this function is one of the more "dangerous" ones...
5407 static s16b poly_r_idx(int r_idx)
5409 monster_race *r_ptr = &r_info[r_idx];
5411 int i, r, lev1, lev2;
5413 /* Hack -- Uniques/Questors never polymorph */
5414 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5415 (r_ptr->flags1 & RF1_QUESTOR))
5418 /* Allowable range of "levels" for resulting monster */
5419 lev1 = r_ptr->level - ((randint(20) / randint(9)) + 1);
5420 lev2 = r_ptr->level + ((randint(20) / randint(9)) + 1);
5422 /* Pick a (possibly new) non-unique race */
5423 for (i = 0; i < 1000; i++)
5425 /* Pick a new race, using a level calculation */
5426 r = get_mon_num((dun_level + r_ptr->level) / 2 + 5);
5428 /* Handle failure */
5434 /* Ignore unique monsters */
5435 if (r_ptr->flags1 & RF1_UNIQUE) continue;
5437 /* Ignore monsters with incompatible levels */
5438 if ((r_ptr->level < lev1) || (r_ptr->level > lev2)) continue;
5440 /* Use that index */
5452 bool polymorph_monster(int y, int x)
5454 cave_type *c_ptr = &cave[y][x];
5455 monster_type *m_ptr = &m_list[c_ptr->m_idx];
5457 bool polymorphed = FALSE;
5459 int old_r_idx = m_ptr->r_idx;
5461 if (p_ptr->inside_arena || p_ptr->inside_battle) return (FALSE);
5463 if ((p_ptr->riding == c_ptr->m_idx) || (m_ptr->mflag2 & MFLAG_KAGE)) return (FALSE);
5465 /* Get the monsters attitude */
5466 friendly = is_friendly(m_ptr);
5467 pet = is_pet(m_ptr);
5469 /* Pick a "new" monster race */
5470 new_r_idx = poly_r_idx(old_r_idx);
5472 /* Handle polymorph */
5473 if (new_r_idx != old_r_idx)
5475 /* "Kill" the "old" monster */
5476 delete_monster_idx(c_ptr->m_idx);
5478 /* Create a new monster (no groups) */
5479 if (place_monster_aux(y, x, new_r_idx, FALSE, FALSE, friendly, pet, FALSE, (bool)(m_ptr->mflag2 & MFLAG_NOPET)))
5486 monster_terrain_sensitive = FALSE;
5488 /* Placing the new monster failed */
5489 place_monster_aux(y, x, old_r_idx, FALSE, FALSE, friendly, pet, TRUE, (bool)(m_ptr->mflag2 & MFLAG_NOPET));
5491 monster_terrain_sensitive = TRUE;
5502 bool dimension_door(void)
5504 int plev = p_ptr->lev;
5507 if (!tgt_pt(&x, &y)) return FALSE;
5509 p_ptr->energy -= 60 - plev;
5511 if (!cave_empty_bold(y, x) || (cave[y][x].info & CAVE_ICKY) ||
5512 (distance(y, x, py, px) > plev / 2 + 10) ||
5513 (!rand_int(plev / 10 + 10)))
5515 if( p_ptr->pclass != CLASS_MIRROR_MASTER ){
5517 msg_print("ÀºÎ¤«¤éʪ¼Á³¦¤ËÌá¤ë»þ¤¦¤Þ¤¯¤¤¤«¤Ê¤«¤Ã¤¿¡ª");
5519 msg_print("You fail to exit the astral plane correctly!");
5524 msg_print("¶À¤ÎÀ¤³¦¤ò¤¦¤Þ¤¯Ä̤ì¤Ê¤«¤Ã¤¿¡ª");
5526 msg_print("You fail to exit the astral plane correctly!");
5529 p_ptr->energy -= 60 - plev;
5530 teleport_player((plev+2)*2);
5532 else teleport_player_to(y, x, TRUE);
5538 bool eat_magic(int power)
5540 object_type * o_ptr;
5543 int recharge_strength = 0;
5549 char o_name[MAX_NLEN];
5551 item_tester_hook = item_tester_hook_recharge;
5555 q = "¤É¤Î¥¢¥¤¥Æ¥à¤«¤éËâÎϤòµÛ¼ý¤·¤Þ¤¹¤«¡©";
5556 s = "ËâÎϤòµÛ¼ý¤Ç¤¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£";
5558 q = "Drain which item? ";
5559 s = "You have nothing to drain.";
5562 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return FALSE;
5566 o_ptr = &inventory[item];
5570 o_ptr = &o_list[0 - item];
5573 k_ptr = &k_info[o_ptr->k_idx];
5574 lev = get_object_level(o_ptr);
5576 if (o_ptr->tval == TV_ROD)
5578 recharge_strength = ((power > lev/2) ? (power - lev/2) : 0) / 5;
5581 if (rand_int(recharge_strength) == 0)
5583 /* Activate the failure code. */
5588 if (o_ptr->timeout > (o_ptr->number - 1) * k_ptr->pval)
5591 msg_print("½¼Å¶Ãæ¤Î¥í¥Ã¥É¤«¤éËâÎϤòµÛ¼ý¤¹¤ë¤³¤È¤Ï¤Ç¤¤Þ¤»¤ó¡£");
5593 msg_print("You can't absorb energy from a discharged rod.");
5600 o_ptr->timeout += k_ptr->pval;
5606 /* All staffs, wands. */
5607 recharge_strength = (100 + power - lev) / 15;
5610 if (recharge_strength < 0) recharge_strength = 0;
5613 if (rand_int(recharge_strength) == 0)
5615 /* Activate the failure code. */
5620 if (o_ptr->pval > 0)
5622 p_ptr->csp += lev / 2;
5625 /* XXX Hack -- unstack if necessary */
5626 if ((o_ptr->tval == TV_STAFF) && (item >= 0) && (o_ptr->number > 1))
5631 /* Get local object */
5634 /* Obtain a local object */
5635 object_copy(q_ptr, o_ptr);
5637 /* Modify quantity */
5640 /* Restore the charges */
5643 /* Unstack the used item */
5645 p_ptr->total_weight -= q_ptr->weight;
5646 item = inven_carry(q_ptr);
5650 msg_print("¾ó¤ò¤Þ¤È¤á¤Ê¤ª¤·¤¿¡£");
5652 msg_print("You unstack your staff.");
5660 msg_print("µÛ¼ý¤Ç¤¤ëËâÎϤ¬¤¢¤ê¤Þ¤»¤ó¡ª");
5662 msg_print("There's no energy there to absorb!");
5666 if (!o_ptr->pval) o_ptr->ident |= IDENT_EMPTY;
5670 /* Inflict the penalties for failing a recharge. */
5673 /* Artifacts are never destroyed. */
5674 if (artifact_p(o_ptr))
5676 object_desc(o_name, o_ptr, TRUE, 0);
5678 msg_format("ËâÎϤ¬µÕή¤·¤¿¡ª%s¤Ï´°Á´¤ËËâÎϤò¼º¤Ã¤¿¡£", o_name);
5680 msg_format("The recharging backfires - %s is completely drained!", o_name);
5684 /* Artifact rods. */
5685 if (o_ptr->tval == TV_ROD)
5686 o_ptr->timeout = k_ptr->pval * o_ptr->number;
5688 /* Artifact wands and staffs. */
5689 else if ((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_STAFF))
5694 /* Get the object description */
5695 object_desc(o_name, o_ptr, FALSE, 0);
5697 /*** Determine Seriousness of Failure ***/
5699 /* Mages recharge objects more safely. */
5700 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)
5702 /* 10% chance to blow up one rod, otherwise draining. */
5703 if (o_ptr->tval == TV_ROD)
5705 if (randint(10) == 1) fail_type = 2;
5708 /* 75% chance to blow up one wand, otherwise draining. */
5709 else if (o_ptr->tval == TV_WAND)
5711 if (randint(3) != 1) fail_type = 2;
5714 /* 50% chance to blow up one staff, otherwise no effect. */
5715 else if (o_ptr->tval == TV_STAFF)
5717 if (randint(2) == 1) fail_type = 2;
5722 /* All other classes get no special favors. */
5725 /* 33% chance to blow up one rod, otherwise draining. */
5726 if (o_ptr->tval == TV_ROD)
5728 if (randint(3) == 1) fail_type = 2;
5731 /* 20% chance of the entire stack, else destroy one wand. */
5732 else if (o_ptr->tval == TV_WAND)
5734 if (randint(5) == 1) fail_type = 3;
5737 /* Blow up one staff. */
5738 else if (o_ptr->tval == TV_STAFF)
5744 /*** Apply draining and destruction. ***/
5746 /* Drain object or stack of objects. */
5749 if (o_ptr->tval == TV_ROD)
5752 msg_print("ËâÎϤ¬µÕÊ®¼Í¤·¤Æ¡¢¥í¥Ã¥É¤«¤é¤µ¤é¤ËËâÎϤòµÛ¤¤¼è¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
5754 msg_print("The recharge backfires, draining the rod further!");
5757 o_ptr->timeout = k_ptr->pval * o_ptr->number;
5759 else if (o_ptr->tval == TV_WAND)
5762 msg_format("%s¤ÏÇË»¤òÌȤ줿¤¬¡¢ËâÎϤ¬Á´¤Æ¼º¤ï¤ì¤¿¡£", o_name);
5764 msg_format("You save your %s from destruction, but all charges are lost.", o_name);
5769 /* Staffs aren't drained. */
5772 /* Destroy an object or one in a stack of objects. */
5775 if (o_ptr->number > 1)
5778 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬°ìËܲõ¤ì¤¿¡ª", o_name);
5780 msg_format("Wild magic consumes one of your %s!", o_name);
5783 /* Reduce rod stack maximum timeout, drain wands. */
5784 if (o_ptr->tval == TV_ROD) o_ptr->timeout -= k_ptr->pval;
5785 if (o_ptr->tval == TV_WAND) o_ptr->pval = o_ptr->pval * (o_ptr->number - 1) / o_ptr->number;
5790 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²¿Ëܤ«²õ¤ì¤¿¡ª", o_name);
5792 msg_format("Wild magic consumes your %s!", o_name);
5795 /* Reduce and describe inventory */
5798 inven_item_increase(item, -1);
5799 inven_item_describe(item);
5800 inven_item_optimize(item);
5803 /* Reduce and describe floor item */
5806 floor_item_increase(0 - item, -1);
5807 floor_item_describe(0 - item);
5808 floor_item_optimize(0 - item);
5812 /* Destroy all members of a stack of objects. */
5815 if (o_ptr->number > 1)
5817 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬Á´¤Æ²õ¤ì¤¿¡ª", o_name);
5819 msg_format("Wild magic consumes all your %s!", o_name);
5824 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²õ¤ì¤¿¡ª", o_name);
5826 msg_format("Wild magic consumes your %s!", o_name);
5831 /* Reduce and describe inventory */
5834 inven_item_increase(item, -999);
5835 inven_item_describe(item);
5836 inven_item_optimize(item);
5839 /* Reduce and describe floor item */
5842 floor_item_increase(0 - item, -999);
5843 floor_item_describe(0 - item);
5844 floor_item_optimize(0 - item);
5850 if (p_ptr->csp > p_ptr->msp)
5852 p_ptr->csp = p_ptr->msp;
5855 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
5856 p_ptr->window |= (PW_INVEN);
5862 bool summon_kin_player(bool pet, int level, int y, int x, bool group)
5864 switch (p_ptr->mimic_form)
5867 switch (p_ptr->prace)
5871 case RACE_BARBARIAN:
5874 summon_kin_type = 'p';
5884 case RACE_MIND_FLAYER:
5887 summon_kin_type = 'h';
5890 summon_kin_type = 'o';
5892 case RACE_HALF_TROLL:
5893 summon_kin_type = 'T';
5895 case RACE_HALF_OGRE:
5896 summon_kin_type = 'O';
5898 case RACE_HALF_GIANT:
5899 case RACE_HALF_TITAN:
5901 summon_kin_type = 'P';
5904 summon_kin_type = 'y';
5907 summon_kin_type = 'K';
5910 summon_kin_type = 'k';
5913 if (one_in_(13)) summon_kin_type = 'U';
5914 else summon_kin_type = 'u';
5916 case RACE_DRACONIAN:
5917 summon_kin_type = 'd';
5921 summon_kin_type = 'g';
5924 if (one_in_(13)) summon_kin_type = 'L';
5925 else summon_kin_type = 's';
5928 summon_kin_type = 'z';
5931 summon_kin_type = 'V';
5934 summon_kin_type = 'G';
5937 summon_kin_type = 'I';
5940 summon_kin_type = '#';
5943 summon_kin_type = 'A';
5946 summon_kin_type = 'U';
5949 summon_kin_type = 'p';
5954 if (one_in_(13)) summon_kin_type = 'U';
5955 else summon_kin_type = 'u';
5957 case MIMIC_DEMON_LORD:
5958 summon_kin_type = 'U';
5961 summon_kin_type = 'V';
5964 return summon_specific((pet ? -1 : 0), y, x, level, SUMMON_KIN, group, FALSE, pet, FALSE, (bool)(!pet));