3 /* Purpose: Spell code (part 3) */
6 * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research, and
9 * not for profit purposes provided that this copyright and statement are
10 * included in all such copies.
15 /* Maximum number of tries for teleporting */
18 /* 1/x chance of reducing stats (for elemental attacks) */
19 #define HURT_CHANCE 16
23 * Teleport a monster, normally up to "dis" grids away.
25 * Attempt to move the monster at least "dis/2" grids away.
27 * But allow variation to prevent infinite loops.
29 bool teleport_away(int m_idx, int dis, bool dec_valour)
31 int oy, ox, d, i, min;
37 monster_type *m_ptr = &m_list[m_idx];
41 if (!m_ptr->r_idx) return (FALSE);
43 /* Save the old location */
47 /* Minimum distance */
51 (((p_ptr->chp * 10) / p_ptr->mhp) > 5) &&
52 (4+randint1(5) < ((p_ptr->chp * 10) / p_ptr->mhp)))
54 chg_virtue(V_VALOUR, -1);
62 /* Verify max distance */
63 if (dis > 200) dis = 200;
65 /* Try several locations */
66 for (i = 0; i < 500; i++)
68 /* Pick a (possibly illegal) location */
71 ny = rand_spread(oy, dis);
72 nx = rand_spread(ox, dis);
73 d = distance(oy, ox, ny, nx);
74 if ((d >= min) && (d <= dis)) break;
77 /* Ignore illegal locations */
78 if (!in_bounds(ny, nx)) continue;
80 /* Require "empty" floor space */
81 if (!cave_empty_bold(ny, nx)) continue;
83 /* Hack -- no teleport onto glyph of warding */
84 if (cave[ny][nx].feat == FEAT_GLYPH) continue;
85 if (cave[ny][nx].feat == FEAT_MINOR_GLYPH) continue;
87 /* ...nor onto the Pattern */
88 if ((cave[ny][nx].feat >= FEAT_PATTERN_START) &&
89 (cave[ny][nx].feat <= FEAT_PATTERN_XTRA2)) continue;
91 /* No teleporting into vaults and such */
92 if (!(p_ptr->inside_quest || p_ptr->inside_arena))
93 if (cave[ny][nx].info & CAVE_ICKY) continue;
95 /* This grid looks good */
102 /* Increase the maximum distance */
105 /* Decrease the minimum distance */
108 /* Stop after MAX_TRIES tries */
109 if (tries > MAX_TRIES) return (FALSE);
113 sound(SOUND_TPOTHER);
115 /* Update the new location */
116 cave[ny][nx].m_idx = m_idx;
118 /* Update the old location */
119 cave[oy][ox].m_idx = 0;
121 /* Move the monster */
125 /* Forget the counter target */
128 /* Update the monster (new location) */
129 update_mon(m_idx, TRUE);
131 /* Redraw the old grid */
134 /* Redraw the new grid */
143 * Teleport monster next to the player
145 void teleport_to_player(int m_idx, int power)
147 int ny, nx, oy, ox, d, i, min;
151 monster_type *m_ptr = &m_list[m_idx];
155 if (!m_ptr->r_idx) return;
158 if (randint1(100) > power) return;
164 /* Save the old location */
168 /* Minimum distance */
171 /* Look until done */
172 while (look && --attempts)
174 /* Verify max distance */
175 if (dis > 200) dis = 200;
177 /* Try several locations */
178 for (i = 0; i < 500; i++)
180 /* Pick a (possibly illegal) location */
183 ny = rand_spread(py, dis);
184 nx = rand_spread(px, dis);
185 d = distance(py, px, ny, nx);
186 if ((d >= min) && (d <= dis)) break;
189 /* Ignore illegal locations */
190 if (!in_bounds(ny, nx)) continue;
192 /* Require "empty" floor space */
193 if (!cave_empty_bold(ny, nx)) continue;
195 /* Hack -- no teleport onto glyph of warding */
196 if (cave[ny][nx].feat == FEAT_GLYPH) continue;
197 if (cave[ny][nx].feat == FEAT_MINOR_GLYPH) continue;
199 /* ...nor onto the Pattern */
200 if ((cave[ny][nx].feat >= FEAT_PATTERN_START) &&
201 (cave[ny][nx].feat <= FEAT_PATTERN_XTRA2)) continue;
203 /* No teleporting into vaults and such */
204 /* if (cave[ny][nx].info & (CAVE_ICKY)) continue; */
206 /* This grid looks good */
213 /* Increase the maximum distance */
216 /* Decrease the minimum distance */
220 if (attempts < 1) return;
223 sound(SOUND_TPOTHER);
225 /* Update the new location */
226 cave[ny][nx].m_idx = m_idx;
228 /* Update the old location */
229 cave[oy][ox].m_idx = 0;
231 /* Move the monster */
235 /* Update the monster (new location) */
236 update_mon(m_idx, TRUE);
238 /* Redraw the old grid */
241 /* Redraw the new grid */
244 p_ptr->update |= (PU_MON_LITE);
249 * Teleport the player to a location up to "dis" grids away.
251 * If no such spaces are readily available, the distance may increase.
252 * Try very hard to move the player at least a quarter that distance.
254 * When long-range teleport effects are considered, there is a nasty
255 * tendency to "bounce" the player between two or three different spots
256 * because these are the only spots that are "far enough" way to satisfy
257 * the algorithm. Therefore, if the teleport distance is more than 50,
258 * we decrease the minimum acceptable distance to try to increase randomness.
261 void teleport_player(int dis)
263 int d, i, min, ox, oy;
266 int xx = -1, yy = -1;
274 if (p_ptr->wild_mode) return;
276 if (p_ptr->anti_tele)
279 msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
281 msg_print("A mysterious force prevents you from teleporting!");
287 if (dis > 200) dis = 200; /* To be on the safe side... */
289 /* Minimum distance */
290 min = dis / (dis > 50 ? 3 : 2);
292 /* Look until done */
297 /* Verify max distance */
298 if (dis > 200) dis = 200;
300 /* Try several locations */
301 for (i = 0; i < 500; i++)
303 /* Pick a (possibly illegal) location */
306 y = rand_spread(py, dis);
307 x = rand_spread(px, dis);
308 d = distance(py, px, y, x);
309 if ((d >= min) && (d <= dis)) break;
312 /* Ignore illegal locations */
313 if (!in_bounds(y, x)) continue;
315 /* Require "naked" floor space or trees */
316 if (!(cave_naked_bold(y, x) ||
317 (cave[y][x].feat == FEAT_TREES))) continue;
319 /* No teleporting into vaults and such */
320 if (cave[y][x].info & CAVE_ICKY) continue;
322 /* This grid looks good */
329 /* Increase the maximum distance */
332 /* Decrease the minimum distance */
335 /* Stop after MAX_TRIES tries */
336 if (tries > MAX_TRIES) return;
340 sound(SOUND_TELEPORT);
343 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
344 msg_format("¡Ø¤³¤Ã¤Á¤À¤¡¡¢%s¡Ù", player_name);
347 /* Save the old location */
351 /* Move the player */
358 tmp = cave[py][px].m_idx;
359 cave[py][px].m_idx = cave[oy][ox].m_idx;
360 cave[oy][ox].m_idx = tmp;
361 m_list[p_ptr->riding].fy = py;
362 m_list[p_ptr->riding].fx = px;
363 update_mon(cave[py][px].m_idx, TRUE);
366 /* Redraw the old spot */
369 /* Monsters with teleport ability may follow the player */
376 if (xx == 0 && yy == 0)
382 if (cave[oy+yy][ox+xx].m_idx)
384 if ((r_info[m_list[cave[oy+yy][ox+xx].m_idx].r_idx].flags6 & RF6_TPORT) &&
385 !(r_info[m_list[cave[oy+yy][ox+xx].m_idx].r_idx].flags3 & RF3_RES_TELE))
387 * The latter limitation is to avoid
388 * totally unkillable suckers...
391 if (!(m_list[cave[oy+yy][ox+xx].m_idx].csleep))
392 teleport_to_player(cave[oy+yy][ox+xx].m_idx, r_info[m_list[cave[oy+yy][ox+xx].m_idx].r_idx].level);
403 /* Redraw the new spot */
406 /* Check for new panel (redraw map) */
410 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
412 /* Update the monsters */
413 p_ptr->update |= (PU_DISTANCE);
416 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
418 /* Handle stuff XXX XXX XXX */
425 * Teleport player to a grid near the given location
427 * This function is slightly obsessive about correctness.
428 * This function allows teleporting into vaults (!)
430 void teleport_player_to(int ny, int nx, bool no_tele)
432 int y, x, oy, ox, dis = 0, ctr = 0;
434 if (p_ptr->anti_tele && no_tele)
437 msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
439 msg_print("A mysterious force prevents you from teleporting!");
445 /* Find a usable location */
448 /* Pick a nearby legal location */
451 y = rand_spread(ny, dis);
452 x = rand_spread(nx, dis);
453 if (in_bounds(y, x)) break;
456 /* Accept "naked" floor grids */
459 if (cave_naked_bold(y, x) || (((cave[y][x].feat == FEAT_DEEP_LAVA) || (cave[y][x].feat == FEAT_DEEP_WATER)) && !cave[y][x].m_idx)) break;
461 else if (cave_empty_bold(y, x) || ((y == py) && (x == px))) break;
463 /* Occasionally advance the distance */
464 if (++ctr > (4 * dis * dis + 4 * dis + 1))
472 sound(SOUND_TELEPORT);
474 /* Save the old location */
478 /* Move the player */
485 tmp = cave[py][px].m_idx;
486 cave[py][px].m_idx = cave[oy][ox].m_idx;
487 cave[oy][ox].m_idx = tmp;
488 m_list[p_ptr->riding].fy = py;
489 m_list[p_ptr->riding].fx = px;
490 update_mon(cave[py][px].m_idx, TRUE);
495 /* Redraw the old spot */
498 /* Redraw the new spot */
501 /* Check for new panel (redraw map) */
505 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
507 /* Update the monsters */
508 p_ptr->update |= (PU_DISTANCE);
511 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
513 /* Handle stuff XXX XXX XXX */
520 * Teleport the player one level up or down (random when legal)
522 void teleport_player_level(void)
524 /* No effect in arena or quest */
525 if (p_ptr->inside_arena || (p_ptr->inside_quest && !random_quest_number(dun_level)) ||
526 (quest_number(dun_level) && (dun_level > 1) && ironman_downward))
529 msg_print("¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£");
531 msg_print("There is no effect.");
537 if (p_ptr->anti_tele)
540 msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
542 msg_print("A mysterious force prevents you from teleporting!");
548 if (ironman_downward || (dun_level <= d_info[dungeon_type].mindepth))
551 msg_print("¤¢¤Ê¤¿¤Ï¾²¤òÆͤÇˤäÆÄÀ¤ó¤Ç¤¤¤¯¡£");
553 msg_print("You sink through the floor.");
557 dungeon_type = p_ptr->recall_dungeon;
562 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL);
564 if (autosave_l) do_cmd_save_game(TRUE);
568 dun_level = d_info[dungeon_type].mindepth;
576 p_ptr->leaving = TRUE;
578 else if (quest_number(dun_level) || (dun_level >= d_info[dungeon_type].maxdepth))
581 msg_print("¤¢¤Ê¤¿¤ÏÅ·°æ¤òÆͤÇˤäÆÃè¤ØÉ⤤¤Æ¤¤¤¯¡£");
583 msg_print("You rise up through the ceiling.");
587 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, -1, NULL);
589 if (autosave_l) do_cmd_save_game(TRUE);
593 if (!dun_level) dungeon_type = 0;
598 p_ptr->inside_quest = 0;
599 p_ptr->leaving = TRUE;
601 else if (randint0(100) < 50)
604 msg_print("¤¢¤Ê¤¿¤ÏÅ·°æ¤òÆͤÇˤäÆÃè¤ØÉ⤤¤Æ¤¤¤¯¡£");
606 msg_print("You rise up through the ceiling.");
610 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, -1, NULL);
612 if (autosave_l) do_cmd_save_game(TRUE);
616 if (!dun_level) dungeon_type = 0;
619 p_ptr->leaving = TRUE;
624 msg_print("¤¢¤Ê¤¿¤Ï¾²¤òÆͤÇˤäÆÄÀ¤ó¤Ç¤¤¤¯¡£");
626 msg_print("You sink through the floor.");
629 if (!dun_level) dungeon_type = p_ptr->recall_dungeon;
631 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL);
633 if (autosave_l) do_cmd_save_game(TRUE);
638 p_ptr->leaving = TRUE;
641 if (!dun_level && dungeon_type)
643 p_ptr->leaving_dungeon = TRUE;
644 p_ptr->wilderness_y = d_info[dungeon_type].dy;
645 p_ptr->wilderness_x = d_info[dungeon_type].dx;
646 p_ptr->recall_dungeon = dungeon_type;
649 if (!dun_level) dungeon_type = 0;
652 sound(SOUND_TPLEVEL);
657 static int choose_dungeon(cptr note)
663 /* Allocate the "dun" array */
664 C_MAKE(dun, max_d_idx, s16b);
667 for(i = 1; i < max_d_idx; i++)
672 if (!d_info[i].maxdepth) continue;
673 if (!max_dlv[i]) continue;
674 if (d_info[i].final_guardian)
676 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
678 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
681 sprintf(buf," %c) %c%-12s : ºÇÂç %d ³¬", 'a'+num, seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
683 sprintf(buf," %c) %c%-16s : Max level %d", 'a'+num, seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
689 prt(format("¤É¤Î¥À¥ó¥¸¥ç¥ó%s¤·¤Þ¤¹¤«:", note), 0, 0);
691 prt(format("Which dungeon do you %s?: ", note), 0, 0);
698 /* Free the "dun" array */
699 C_KILL(dun, max_d_idx, s16b);
704 if (i >= 'a' && i <('a'+num))
706 select_dungeon = dun[i-'a'];
713 /* Free the "dun" array */
714 C_KILL(dun, max_d_idx, s16b);
716 return select_dungeon;
721 * Recall the player to town or dungeon
723 bool recall_player(int turns)
726 * TODO: Recall the player to the last
727 * visited town when in the wilderness
731 if (p_ptr->inside_arena || ironman_downward)
734 msg_print("²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
736 msg_print("Nothing happens.");
742 if (dun_level && (max_dlv[dungeon_type] > dun_level) && !p_ptr->inside_quest && !p_ptr->word_recall)
745 if (get_check("¤³¤³¤ÏºÇ¿¼Åþ㳬¤è¤êÀõ¤¤³¬¤Ç¤¹¡£¤³¤Î³¬¤ËÌá¤Ã¤ÆÍè¤Þ¤¹¤«¡© "))
747 if (get_check("Reset recall depth? "))
750 max_dlv[dungeon_type] = dun_level;
751 if (record_maxdeapth)
753 do_cmd_write_nikki(NIKKI_TRUMP, dungeon_type, "µ¢´Ô¤Î¤È¤¤Ë");
755 do_cmd_write_nikki(NIKKI_TRUMP, dungeon_type, "when recall from dungeon");
760 if (!p_ptr->word_recall)
766 select_dungeon = choose_dungeon("¤Ëµ¢´Ô");
768 select_dungeon = choose_dungeon("recall");
770 if (!select_dungeon) return FALSE;
771 p_ptr->recall_dungeon = select_dungeon;
773 p_ptr->word_recall = turns;
775 msg_print("²ó¤ê¤ÎÂ絤¤¬Ä¥¤ê¤Ä¤á¤Æ¤¤¿...");
777 msg_print("The air about you becomes charged...");
780 p_ptr->redraw |= (PR_STATUS);
784 p_ptr->word_recall = 0;
786 msg_print("Ä¥¤ê¤Ä¤á¤¿Â絤¤¬Î®¤ìµî¤Ã¤¿...");
788 msg_print("A tension leaves the air around you...");
791 p_ptr->redraw |= (PR_STATUS);
797 bool word_of_recall(void)
799 return(recall_player(randint0(21) + 15));
803 bool reset_recall(void)
805 int select_dungeon, dummy = 0;
810 select_dungeon = choose_dungeon("¤ò¥»¥Ã¥È");
812 select_dungeon = choose_dungeon("reset");
815 if (!select_dungeon) return FALSE;
818 sprintf(ppp, "²¿³¬¤Ë¥»¥Ã¥È¤·¤Þ¤¹¤« (%d-%d):", d_info[select_dungeon].mindepth, max_dlv[select_dungeon]);
820 sprintf(ppp, "Reset to which level (%d-%d): ", d_info[select_dungeon].mindepth, max_dlv[select_dungeon]);
825 sprintf(tmp_val, "%d", MAX(dun_level, 1));
827 /* Ask for a level */
828 if (get_string(ppp, tmp_val, 10))
830 /* Extract request */
831 dummy = atoi(tmp_val);
834 if (dummy < 1) dummy = 1;
837 if (dummy > max_dlv[select_dungeon]) dummy = max_dlv[select_dungeon];
838 if (dummy < d_info[select_dungeon].mindepth) dummy = d_info[select_dungeon].mindepth;
840 max_dlv[select_dungeon] = dummy;
842 if (record_maxdeapth)
844 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "¥Õ¥í¥¢¡¦¥ê¥»¥Ã¥È¤Ç");
846 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "using a scroll of reset recall");
850 msg_format("%s¤Îµ¢´Ô¥ì¥Ù¥ë¤ò %d ³¬¤Ë¥»¥Ã¥È¡£", d_name+d_info[select_dungeon].name, dummy, dummy * 50);
852 msg_format("Recall depth set to level %d (%d').", dummy, dummy * 50);
865 * Apply disenchantment to the player's stuff
867 * XXX XXX XXX This function is also called from the "melee" code
869 * The "mode" is currently unused.
871 * Return "TRUE" if the player notices anything
873 bool apply_disenchant(int mode)
877 char o_name[MAX_NLEN];
878 int to_h, to_d, to_a, pval;
885 /* Pick a random slot */
888 case 1: t = INVEN_RARM; break;
889 case 2: t = INVEN_LARM; break;
890 case 3: t = INVEN_BOW; break;
891 case 4: t = INVEN_BODY; break;
892 case 5: t = INVEN_OUTER; break;
893 case 6: t = INVEN_HEAD; break;
894 case 7: t = INVEN_HANDS; break;
895 case 8: t = INVEN_FEET; break;
899 o_ptr = &inventory[t];
901 /* No item, nothing happens */
902 if (!o_ptr->k_idx) return (FALSE);
905 /* Nothing to disenchant */
906 if ((o_ptr->to_h <= 0) && (o_ptr->to_d <= 0) && (o_ptr->to_a <= 0) && (o_ptr->pval <= 1))
908 /* Nothing to notice */
913 /* Describe the object */
914 object_desc(o_name, o_ptr, FALSE, 0);
917 /* Artifacts have 71% chance to resist */
918 if ((artifact_p(o_ptr) || o_ptr->art_name) && (randint0(100) < 71))
922 msg_format("%s(%c)¤ÏÎô²½¤òÄ·¤ÍÊÖ¤·¤¿¡ª",o_name, index_to_label(t) );
924 msg_format("Your %s (%c) resist%s disenchantment!",
925 o_name, index_to_label(t),
926 ((o_ptr->number != 1) ? "" : "s"));
935 /* Memorize old value */
941 /* Disenchant tohit */
942 if (o_ptr->to_h > 0) o_ptr->to_h--;
943 if ((o_ptr->to_h > 5) && (randint0(100) < 20)) o_ptr->to_h--;
945 /* Disenchant todam */
946 if (o_ptr->to_d > 0) o_ptr->to_d--;
947 if ((o_ptr->to_d > 5) && (randint0(100) < 20)) o_ptr->to_d--;
949 /* Disenchant toac */
950 if (o_ptr->to_a > 0) o_ptr->to_a--;
951 if ((o_ptr->to_a > 5) && (randint0(100) < 20)) o_ptr->to_a--;
953 /* Disenchant pval (occasionally) */
954 if ((o_ptr->pval > 1) && one_in_(13)) o_ptr->pval--;
956 if ((to_h != o_ptr->to_h) || (to_d != o_ptr->to_d) ||
957 (to_a != o_ptr->to_a) || (pval != o_ptr->pval))
961 msg_format("%s(%c)¤ÏÎô²½¤·¤Æ¤·¤Þ¤Ã¤¿¡ª",
962 o_name, index_to_label(t) );
964 msg_format("Your %s (%c) %s disenchanted!",
965 o_name, index_to_label(t),
966 ((o_ptr->number != 1) ? "were" : "was"));
969 chg_virtue(V_HARMONY, 1);
970 chg_virtue(V_ENCHANT, -2);
972 /* Recalculate bonuses */
973 p_ptr->update |= (PU_BONUS);
976 p_ptr->window |= (PW_EQUIP | PW_PLAYER);
986 void mutate_player(void)
988 int max1, cur1, max2, cur2, ii, jj, i;
990 /* Pick a pair of stats */
992 for (jj = ii; jj == ii; jj = randint0(6)) /* loop */;
994 max1 = p_ptr->stat_max[ii];
995 cur1 = p_ptr->stat_cur[ii];
996 max2 = p_ptr->stat_max[jj];
997 cur2 = p_ptr->stat_cur[jj];
999 p_ptr->stat_max[ii] = max2;
1000 p_ptr->stat_cur[ii] = cur2;
1001 p_ptr->stat_max[jj] = max1;
1002 p_ptr->stat_cur[jj] = cur1;
1006 if(p_ptr->stat_max[i] > p_ptr->stat_max_max[i]) p_ptr->stat_max[i] = p_ptr->stat_max_max[i];
1007 if(p_ptr->stat_cur[i] > p_ptr->stat_max_max[i]) p_ptr->stat_cur[i] = p_ptr->stat_max_max[i];
1010 p_ptr->update |= (PU_BONUS);
1017 void apply_nexus(monster_type *m_ptr)
1019 switch (randint1(7))
1021 case 1: case 2: case 3:
1023 teleport_player(200);
1029 teleport_player_to(m_ptr->fy, m_ptr->fx, TRUE);
1035 if (randint0(100) < p_ptr->skill_sav)
1038 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
1040 msg_print("You resist the effects!");
1046 /* Teleport Level */
1047 teleport_player_level();
1053 if (randint0(100) < p_ptr->skill_sav)
1056 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
1058 msg_print("You resist the effects!");
1065 msg_print("ÂΤ¬¤Í¤¸¤ì»Ï¤á¤¿...");
1067 msg_print("Your body starts to scramble...");
1078 * Charge a lite (torch or latern)
1080 void phlogiston(void)
1083 object_type * o_ptr = &inventory[INVEN_LITE];
1086 if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_LANTERN))
1088 max_flog = FUEL_LAMP;
1092 else if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_TORCH))
1094 max_flog = FUEL_TORCH;
1097 /* No torch to refill */
1101 msg_print("dzÁǤò¾ÃÈñ¤¹¤ë¥¢¥¤¥Æ¥à¤òÁõÈ÷¤·¤Æ¤¤¤Þ¤»¤ó¡£");
1103 msg_print("You are not wielding anything which uses phlogiston.");
1109 if (o_ptr->xtra4 >= max_flog)
1112 msg_print("¤³¤Î¥¢¥¤¥Æ¥à¤Ë¤Ï¤³¤ì°Ê¾ådzÁǤòÊä½¼¤Ç¤¤Þ¤»¤ó¡£");
1114 msg_print("No more phlogiston can be put in this item.");
1121 o_ptr->xtra4 += (max_flog / 2);
1125 msg_print("¾ÈÌÀÍÑ¥¢¥¤¥Æ¥à¤ËdzÁǤòÊä½¼¤·¤¿¡£");
1127 msg_print("You add phlogiston to your light item.");
1132 if (o_ptr->xtra4 >= max_flog)
1134 o_ptr->xtra4 = max_flog;
1136 msg_print("¾ÈÌÀÍÑ¥¢¥¤¥Æ¥à¤ÏËþ¥¿¥ó¤Ë¤Ê¤Ã¤¿¡£");
1138 msg_print("Your light item is full.");
1143 /* Recalculate torch */
1144 p_ptr->update |= (PU_TORCH);
1148 bool item_tester_hook_weapon_nobow(object_type *o_ptr)
1150 switch (o_ptr->tval)
1160 if (o_ptr->sval != SV_DOKUBARI) return (TRUE);
1168 * Brand the current weapon
1170 void brand_weapon(int brand_type)
1177 /* Assume enchant weapon */
1178 item_tester_hook = item_tester_hook_weapon_nobow;
1179 item_tester_no_ryoute = TRUE;
1183 q = "¤É¤ÎÉð´ï¤ò¶¯²½¤·¤Þ¤¹¤«? ";
1184 s = "¶¯²½¤Ç¤¤ëÉð´ï¤¬¤Ê¤¤¡£";
1186 q = "Enchant which weapon? ";
1187 s = "You have nothing to enchant.";
1190 if (!get_item(&item, q, s, (USE_EQUIP))) return;
1192 /* Get the item (in the pack) */
1195 o_ptr = &inventory[item];
1198 /* Get the item (on the floor) */
1201 o_ptr = &o_list[0 - item];
1205 /* you can never modify artifacts / ego-items */
1206 /* you can never modify cursed items */
1207 /* TY: You _can_ modify broken items (if you're silly enough) */
1208 if (o_ptr->k_idx && !artifact_p(o_ptr) && !ego_item_p(o_ptr) &&
1209 !o_ptr->art_name && !cursed_p(o_ptr) &&
1210 !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) &&
1211 !((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE)) &&
1212 !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DIAMOND_EDGE)))
1216 /* Let's get the name before it is changed... */
1217 char o_name[MAX_NLEN];
1218 object_desc(o_name, o_ptr, FALSE, 0);
1223 if (o_ptr->tval == TV_SWORD)
1226 act = "¤Ï±Ô¤µ¤òÁý¤·¤¿¡ª";
1228 act = "becomes very sharp!";
1231 o_ptr->name2 = EGO_SHARPNESS;
1232 o_ptr->pval = m_bonus(5, dun_level) + 1;
1237 act = "¤ÏÇ˲õÎϤòÁý¤·¤¿¡ª";
1239 act = "seems very powerful.";
1242 o_ptr->name2 = EGO_EARTHQUAKES;
1243 o_ptr->pval = m_bonus(3, dun_level);
1248 act = "¤ÏÅÅ·â¤Ëʤ¤ï¤ì¤¿¡ª";
1250 act = "coverd with lightning!";
1253 o_ptr->name2 = EGO_BRAND_ELEC;
1257 act = "¤Ï»À¤Ëʤ¤ï¤ì¤¿¡ª";
1259 act = "coated with acid!";
1262 o_ptr->name2 = EGO_BRAND_ACID;
1266 act = "¤Ï¼Ù°¤Ê¤ë²øʪ¤òµá¤á¤Æ¤¤¤ë¡ª";
1268 act = "seems looking for evil monster!";
1271 o_ptr->name2 = EGO_SLAY_EVIL;
1275 act = "¤Ï°ÛÀ¤³¦¤Î½»¿Í¤ÎÆùÂΤòµá¤á¤Æ¤¤¤ë¡ª";
1277 act = "seems looking for demon!";
1280 o_ptr->name2 = EGO_SLAY_DEMON;
1284 act = "¤Ï»Ó¤òµá¤á¤Æ¤¤¤ë¡ª";
1286 act = "seems looking for undead!";
1289 o_ptr->name2 = EGO_SLAY_UNDEAD;
1293 act = "¤Ïưʪ¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1295 act = "seems looking for animal!";
1298 o_ptr->name2 = EGO_SLAY_ANIMAL;
1302 act = "¤Ï¥É¥é¥´¥ó¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1304 act = "seems looking for dragon!";
1307 o_ptr->name2 = EGO_SLAY_DRAGON;
1311 act = "¤Ï¥È¥í¥ë¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1313 act = "seems looking for troll!";
1316 o_ptr->name2 = EGO_SLAY_TROLL;
1320 act = "¤Ï¥ª¡¼¥¯¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1322 act = "seems looking for orc!";
1325 o_ptr->name2 = EGO_SLAY_ORC;
1329 act = "¤Ïµð¿Í¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1331 act = "seems looking for giant!";
1334 o_ptr->name2 = EGO_SLAY_GIANT;
1338 act = "¤ÏÈó¾ï¤ËÉÔ°ÂÄê¤Ë¤Ê¤Ã¤¿¤è¤¦¤À¡£";
1340 act = "seems very unstable now.";
1343 o_ptr->name2 = EGO_TRUMP;
1344 o_ptr->pval = randint1(2);
1348 act = "¤Ï·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1350 act = "thirsts for blood!";
1353 o_ptr->name2 = EGO_VAMPIRIC;
1357 act = "¤ÏÆǤËʤ¤ï¤ì¤¿¡£";
1359 act = "is coated with poison.";
1362 o_ptr->name2 = EGO_BRAND_POIS;
1366 act = "¤Ï½ã¥í¥°¥ë¥¹¤Ë°û¤ß¹þ¤Þ¤ì¤¿¡£";
1368 act = "is engulfed in raw Logrus!";
1371 o_ptr->name2 = EGO_CHAOTIC;
1375 act = "¤Ï±ê¤Î¥·¡¼¥ë¥É¤Ëʤ¤ï¤ì¤¿¡ª";
1377 act = "is covered in a fiery shield!";
1380 o_ptr->name2 = EGO_BRAND_FIRE;
1384 act = "¤Ï¿¼¤¯Î䤿¤¤¥Ö¥ë¡¼¤Ëµ±¤¤¤¿¡ª";
1386 act = "glows deep, icy blue!";
1389 o_ptr->name2 = EGO_BRAND_COLD;
1394 msg_format("¤¢¤Ê¤¿¤Î%s%s", o_name, act);
1396 msg_format("Your %s %s", o_name, act);
1400 enchant(o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
1402 o_ptr->discount = 99;
1403 chg_virtue(V_ENCHANT, 2);
1407 if (flush_failure) flush();
1410 msg_print("°ÀÉղä˼ºÇÔ¤·¤¿¡£");
1412 msg_print("The Branding failed.");
1415 chg_virtue(V_ENCHANT, -2);
1421 void call_the_(void)
1425 if (cave_floor_bold(py - 1, px - 1) &&
1426 cave_floor_bold(py - 1, px ) &&
1427 cave_floor_bold(py - 1, px + 1) &&
1428 cave_floor_bold(py , px - 1) &&
1429 cave_floor_bold(py , px + 1) &&
1430 cave_floor_bold(py + 1, px - 1) &&
1431 cave_floor_bold(py + 1, px ) &&
1432 cave_floor_bold(py + 1, px + 1))
1434 for (i = 1; i < 10; i++)
1436 if (i-5) fire_ball(GF_ROCKET, i, 175, 2);
1439 for (i = 1; i < 10; i++)
1441 if (i-5) fire_ball(GF_MANA, i, 175, 3);
1444 for (i = 1; i < 10; i++)
1446 if (i-5) fire_ball(GF_NUKE, i, 175, 4);
1452 msg_format("¤¢¤Ê¤¿¤Ï%s¤òÊɤ˶᤹¤®¤ë¾ì½ê¤Ç¾§¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª",
1453 ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "µ§¤ê" : "¼öʸ"));
1454 msg_print("Â礤ÊÇúȯ²»¤¬¤¢¤Ã¤¿¡ª");
1456 msg_format("You %s the %s too close to a wall!",
1457 ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "recite" : "cast"),
1458 ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "prayer" : "spell"));
1459 msg_print("There is a loud explosion!");
1463 if (destroy_area(py, px, 15 + p_ptr->lev + randint0(11), TRUE))
1465 msg_print("¥À¥ó¥¸¥ç¥ó¤¬Êø²õ¤·¤¿...");
1467 msg_print("The dungeon collapses...");
1472 msg_print("¥À¥ó¥¸¥ç¥ó¤ÏÂ礤¯Íɤ줿¡£");
1474 msg_print("The dungeon trembles.");
1479 take_hit(DAMAGE_NOESCAPE, 100 + randint1(150), "¼«»¦Åª¤Êµõ̵¾·Íè", -1);
1481 take_hit(DAMAGE_NOESCAPE, 100 + randint1(150), "a suicidal Call the Void", -1);
1489 * Fetch an item (teleport it right underneath the caster)
1491 void fetch(int dir, int wgt, bool require_los)
1497 char o_name[MAX_NLEN];
1499 /* Check to see if an object is already there */
1500 if (cave[py][px].o_idx)
1503 msg_print("¼«Ê¬¤Î¤β¼¤Ë¤¢¤ëʪ¤Ï¼è¤ì¤Þ¤»¤ó¡£");
1505 msg_print("You can't fetch when you're already standing on something.");
1512 if (dir == 5 && target_okay())
1517 if (distance(py, px, ty, tx) > MAX_RANGE)
1520 msg_print("¤½¤ó¤Ê¤Ë±ó¤¯¤Ë¤¢¤ëʪ¤Ï¼è¤ì¤Þ¤»¤ó¡ª");
1522 msg_print("You can't fetch something that far away!");
1528 c_ptr = &cave[ty][tx];
1530 /* We need an item to fetch */
1534 msg_print("¤½¤³¤Ë¤Ï²¿¤â¤¢¤ê¤Þ¤»¤ó¡£");
1536 msg_print("There is no object at this place.");
1542 /* No fetching from vault */
1543 if (c_ptr->info & CAVE_ICKY)
1546 msg_print("¥¢¥¤¥Æ¥à¤¬¥³¥ó¥È¥í¡¼¥ë¤ò³°¤ì¤ÆÍî¤Á¤¿¡£");
1548 msg_print("The item slips from your control.");
1554 /* We need to see the item */
1555 if (require_los && !player_has_los_bold(ty, tx))
1558 msg_print("¤½¤³¤Ï¤¢¤Ê¤¿¤Î»ë³¦¤ËÆþ¤Ã¤Æ¤¤¤Þ¤»¤ó¡£");
1560 msg_print("You have no direct line of sight to that location.");
1568 /* Use a direction */
1569 ty = py; /* Where to drop the item */
1577 c_ptr = &cave[ty][tx];
1579 if ((distance(py, px, ty, tx) > MAX_RANGE) ||
1580 !cave_floor_bold(ty, tx)) return;
1582 while (!c_ptr->o_idx);
1585 o_ptr = &o_list[c_ptr->o_idx];
1587 if (o_ptr->weight > wgt)
1589 /* Too heavy to 'fetch' */
1591 msg_print("¤½¤Î¥¢¥¤¥Æ¥à¤Ï½Å²á¤®¤Þ¤¹¡£");
1593 msg_print("The object is too heavy.");
1600 c_ptr->o_idx = o_ptr->next_o_idx;
1601 cave[py][px].o_idx = i; /* 'move' it */
1602 o_ptr->next_o_idx = 0;
1603 o_ptr->iy = (byte)py;
1604 o_ptr->ix = (byte)px;
1606 object_desc(o_name, o_ptr, TRUE, 0);
1608 msg_format("%^s¤¬¤¢¤Ê¤¿¤Î¸µ¤ËÈô¤ó¤Ç¤¤¿¡£", o_name);
1610 msg_format("%^s flies through the air to your feet.", o_name);
1615 p_ptr->redraw |= PR_MAP;
1619 void alter_reality(void)
1621 if (!quest_number(dun_level) && dun_level)
1624 msg_print("À¤³¦¤¬ÊѤï¤Ã¤¿¡ª");
1626 msg_print("The world changes!");
1630 if (autosave_l) do_cmd_save_game(TRUE);
1633 p_ptr->leaving = TRUE;
1638 msg_print("À¤³¦¤¬¾¯¤·¤Î´ÖÊѲ½¤·¤¿¤è¤¦¤À¡£");
1640 msg_print("The world seems to change for a moment!");
1648 * Leave a "glyph of warding" which prevents monster movement
1650 bool warding_glyph(void)
1653 if (!cave_clean_bold(py, px))
1656 msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£");
1658 msg_print("The object resists the spell.");
1664 /* Create a glyph */
1665 cave_set_feat(py, px, FEAT_GLYPH);
1670 bool warding_mirror(void)
1673 if (!cave_clean_bold(py, px))
1676 msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£");
1678 msg_print("The object resists the spell.");
1684 /* Create a glyph */
1685 cave_set_feat(py, px, FEAT_MIRROR);
1694 * Leave an "explosive rune" which prevents monster movement
1696 bool explosive_rune(void)
1699 if (!cave_clean_bold(py, px))
1702 msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£");
1704 msg_print("The object resists the spell.");
1710 /* Create a glyph */
1711 cave_set_feat(py, px, FEAT_MINOR_GLYPH);
1718 * Identify everything being carried.
1719 * Done by a potion of "self knowledge".
1721 void identify_pack(void)
1725 /* Simply identify and know every item */
1726 for (i = 0; i < INVEN_TOTAL; i++)
1728 object_type *o_ptr = &inventory[i];
1730 /* Skip non-objects */
1731 if (!o_ptr->k_idx) continue;
1734 identify_item(o_ptr);
1740 * Used by the "enchant" function (chance of failure)
1741 * (modified for Zangband, we need better stuff there...) -- TY
1743 static int enchant_table[16] =
1745 0, 10, 50, 100, 200,
1746 300, 400, 500, 650, 800,
1747 950, 987, 993, 995, 998,
1753 * Removes curses from items in inventory
1755 * Note that Items which are "Perma-Cursed" (The One Ring,
1756 * The Crown of Morgoth) can NEVER be uncursed.
1758 * Note that if "all" is FALSE, then Items which are
1759 * "Heavy-Cursed" (Mormegil, Calris, and Weapons of Morgul)
1760 * will not be uncursed.
1762 static int remove_curse_aux(int all)
1766 /* Attempt to uncurse items being worn */
1767 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1769 object_type *o_ptr = &inventory[i];
1771 /* Skip non-objects */
1772 if (!o_ptr->k_idx) continue;
1774 /* Uncursed already */
1775 if (!cursed_p(o_ptr)) continue;
1777 /* Heavily Cursed Items need a special spell */
1778 if (!all && (o_ptr->curse_flags & TRC_HEAVY_CURSE)) continue;
1780 /* Perma-Cursed Items can NEVER be uncursed */
1781 if (o_ptr->curse_flags & TRC_PERMA_CURSE) continue;
1784 o_ptr->curse_flags = 0L;
1786 /* Hack -- Assume felt */
1787 o_ptr->ident |= (IDENT_SENSE);
1790 o_ptr->feeling = FEEL_NONE;
1792 /* Recalculate the bonuses */
1793 p_ptr->update |= (PU_BONUS);
1796 p_ptr->window |= (PW_EQUIP);
1798 /* Count the uncursings */
1802 /* Return "something uncursed" */
1808 * Remove most curses
1810 bool remove_curse(void)
1812 return (remove_curse_aux(FALSE));
1818 bool remove_all_curse(void)
1820 return (remove_curse_aux(TRUE));
1825 * Turns an object into gold, gain some of its value in a shop
1834 char o_name[MAX_NLEN];
1835 char out_val[MAX_NLEN+40];
1839 /* Hack -- force destruction */
1840 if (command_arg > 0) force = TRUE;
1844 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò¶â¤ËÊѤ¨¤Þ¤¹¤«¡©";
1845 s = "¶â¤ËÊѤ¨¤é¤ì¤ëʪ¤¬¤¢¤ê¤Þ¤»¤ó¡£";
1847 q = "Turn which item to gold? ";
1848 s = "You have nothing to turn to gold.";
1851 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return (FALSE);
1853 /* Get the item (in the pack) */
1856 o_ptr = &inventory[item];
1859 /* Get the item (on the floor) */
1862 o_ptr = &o_list[0 - item];
1866 /* See how many items */
1867 if (o_ptr->number > 1)
1869 /* Get a quantity */
1870 amt = get_quantity(NULL, o_ptr->number);
1872 /* Allow user abort */
1873 if (amt <= 0) return FALSE;
1877 /* Describe the object */
1878 old_number = o_ptr->number;
1879 o_ptr->number = amt;
1880 object_desc(o_name, o_ptr, TRUE, 3);
1881 o_ptr->number = old_number;
1883 /* Verify unless quantity given */
1886 if (confirm_destroy || (object_value(o_ptr) > 0))
1888 /* Make a verification */
1890 sprintf(out_val, "ËÜÅö¤Ë%s¤ò¶â¤ËÊѤ¨¤Þ¤¹¤«¡©", o_name);
1892 sprintf(out_val, "Really turn %s to gold? ", o_name);
1895 if (!get_check(out_val)) return FALSE;
1899 /* Artifacts cannot be destroyed */
1900 if (artifact_p(o_ptr) || o_ptr->art_name)
1902 byte feel = FEEL_SPECIAL;
1906 msg_format("%s¤ò¶â¤ËÊѤ¨¤ë¤³¤È¤Ë¼ºÇÔ¤·¤¿¡£", o_name);
1908 msg_format("You fail to turn %s to gold!", o_name);
1912 /* Hack -- Handle icky artifacts */
1913 if (cursed_p(o_ptr) || broken_p(o_ptr)) feel = FEEL_TERRIBLE;
1915 /* Hack -- inscribe the artifact */
1916 o_ptr->feeling = feel;
1918 /* We have "felt" it (again) */
1919 o_ptr->ident |= (IDENT_SENSE);
1921 /* Combine the pack */
1922 p_ptr->notice |= (PN_COMBINE);
1925 p_ptr->window |= (PW_INVEN | PW_EQUIP);
1931 price = object_value_real(o_ptr);
1937 msg_format("%s¤ò¥Ë¥»¤Î¶â¤ËÊѤ¨¤¿¡£", o_name);
1939 msg_format("You turn %s to fool's gold.", o_name);
1947 if (amt > 1) price *= amt;
1949 if (price > 30000) price = 30000;
1951 msg_format("%s¤ò¡ð%d ¤Î¶â¤ËÊѤ¨¤¿¡£", o_name, price);
1953 msg_format("You turn %s to %ld coins worth of gold.", o_name, price);
1959 p_ptr->redraw |= (PR_GOLD);
1962 p_ptr->window |= (PW_PLAYER);
1966 /* Eliminate the item (from the pack) */
1969 inven_item_increase(item, -amt);
1970 inven_item_describe(item);
1971 inven_item_optimize(item);
1974 /* Eliminate the item (from the floor) */
1977 floor_item_increase(0 - item, -amt);
1978 floor_item_describe(0 - item);
1979 floor_item_optimize(0 - item);
1987 * Create stairs at the player location
1989 void stair_creation(void)
1992 if (!cave_valid_bold(py, px))
1995 msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£");
1997 msg_print("The object resists the spell.");
2004 delete_object(py, px);
2006 /* Create a staircase */
2007 if (p_ptr->inside_arena || (p_ptr->inside_quest && (p_ptr->inside_quest < MIN_RANDOM_QUEST)) || p_ptr->inside_battle || !dun_level)
2009 /* arena or quest */
2011 msg_print("¸ú²Ì¤¬¤¢¤ê¤Þ¤»¤ó¡ª");
2013 msg_print("There is no effect!");
2017 else if (ironman_downward)
2019 /* Town/wilderness or Ironman */
2020 cave_set_feat(py, px, FEAT_MORE);
2022 else if (quest_number(dun_level) || (dun_level >= d_info[dungeon_type].maxdepth))
2025 cave_set_feat(py, px, FEAT_LESS);
2027 else if (randint0(100) < 50)
2029 cave_set_feat(py, px, FEAT_MORE);
2033 cave_set_feat(py, px, FEAT_LESS);
2039 * Hook to specify "weapon"
2041 bool item_tester_hook_weapon(object_type *o_ptr)
2043 switch (o_ptr->tval)
2057 if (o_ptr->sval != SV_DOKUBARI) return (TRUE);
2064 bool item_tester_hook_weapon2(object_type *o_ptr)
2066 switch (o_ptr->tval)
2086 * Hook to specify "armour"
2088 bool item_tester_hook_armour(object_type *o_ptr)
2090 switch (o_ptr->tval)
2110 bool item_tester_hook_corpse(object_type *o_ptr)
2112 switch (o_ptr->tval)
2125 * Check if an object is weapon or armour (but not arrow, bolt, or shot)
2127 bool item_tester_hook_weapon_armour(object_type *o_ptr)
2129 switch (o_ptr->tval)
2158 * Check if an object is nameless weapon or armour
2160 bool item_tester_hook_nameless_weapon_armour(object_type *o_ptr)
2162 if (o_ptr->name1 || o_ptr->art_name || o_ptr->name2 || o_ptr->xtra3)
2165 switch (o_ptr->tval)
2194 * Break the curse of an item
2196 static void break_curse(object_type *o_ptr)
2198 if (cursed_p(o_ptr) && !(o_ptr->curse_flags & TRC_PERMA_CURSE) && !(o_ptr->curse_flags & TRC_HEAVY_CURSE) && (randint0(100) < 25))
2201 msg_print("¤«¤±¤é¤ì¤Æ¤¤¤¿¼ö¤¤¤¬ÂǤÁÇˤé¤ì¤¿¡ª");
2203 msg_print("The curse is broken!");
2206 o_ptr->curse_flags = 0L;
2208 o_ptr->ident |= (IDENT_SENSE);
2210 o_ptr->feeling = FEEL_NONE;
2216 * Enchants a plus onto an item. -RAK-
2218 * Revamped! Now takes item pointer, number of times to try enchanting,
2219 * and a flag of what to try enchanting. Artifacts resist enchantment
2220 * some of the time, and successful enchantment to at least +0 might
2221 * break a curse on the item. -CFT-
2223 * Note that an item can technically be enchanted all the way to +15 if
2224 * you wait a very, very, long time. Going from +9 to +10 only works
2225 * about 5% of the time, and from +10 to +11 only about 1% of the time.
2227 * Note that this function can now be used on "piles" of items, and
2228 * the larger the pile, the lower the chance of success.
2230 bool enchant(object_type *o_ptr, int n, int eflag)
2232 int i, chance, prob;
2234 bool a = (artifact_p(o_ptr) || o_ptr->art_name);
2235 bool force = (eflag & ENCH_FORCE);
2238 /* Large piles resist enchantment */
2239 prob = o_ptr->number * 100;
2241 /* Missiles are easy to enchant */
2242 if ((o_ptr->tval == TV_BOLT) ||
2243 (o_ptr->tval == TV_ARROW) ||
2244 (o_ptr->tval == TV_SHOT))
2250 for (i = 0; i < n; i++)
2252 /* Hack -- Roll for pile resistance */
2253 if (!force && randint0(prob) >= 100) continue;
2255 /* Enchant to hit */
2256 if (eflag & ENCH_TOHIT)
2258 if (o_ptr->to_h < 0) chance = 0;
2259 else if (o_ptr->to_h > 15) chance = 1000;
2260 else chance = enchant_table[o_ptr->to_h];
2262 if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
2267 /* only when you get it above -1 -CFT */
2268 if (o_ptr->to_h >= 0)
2273 /* Enchant to damage */
2274 if (eflag & ENCH_TODAM)
2276 if (o_ptr->to_d < 0) chance = 0;
2277 else if (o_ptr->to_d > 15) chance = 1000;
2278 else chance = enchant_table[o_ptr->to_d];
2280 if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
2285 /* only when you get it above -1 -CFT */
2286 if (o_ptr->to_d >= 0)
2291 /* Enchant to armor class */
2292 if (eflag & ENCH_TOAC)
2294 if (o_ptr->to_a < 0) chance = 0;
2295 else if (o_ptr->to_a > 15) chance = 1000;
2296 else chance = enchant_table[o_ptr->to_a];
2298 if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
2303 /* only when you get it above -1 -CFT */
2304 if (o_ptr->to_a >= 0)
2311 if (!res) return (FALSE);
2313 /* Recalculate bonuses */
2314 p_ptr->update |= (PU_BONUS);
2316 /* Combine / Reorder the pack (later) */
2317 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2320 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2331 * Enchant an item (in the inventory or on the floor)
2332 * Note that "num_ac" requires armour, else weapon
2333 * Returns TRUE if attempted, FALSE if cancelled
2335 bool enchant_spell(int num_hit, int num_dam, int num_ac)
2340 char o_name[MAX_NLEN];
2344 /* Assume enchant weapon */
2345 item_tester_hook = item_tester_hook_weapon;
2346 item_tester_no_ryoute = TRUE;
2348 /* Enchant armor if requested */
2349 if (num_ac) item_tester_hook = item_tester_hook_armour;
2353 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò¶¯²½¤·¤Þ¤¹¤«? ";
2354 s = "¶¯²½¤Ç¤¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2356 q = "Enchant which item? ";
2357 s = "You have nothing to enchant.";
2360 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2362 /* Get the item (in the pack) */
2365 o_ptr = &inventory[item];
2368 /* Get the item (on the floor) */
2371 o_ptr = &o_list[0 - item];
2376 object_desc(o_name, o_ptr, FALSE, 0);
2380 msg_format("%s ¤ÏÌÀ¤ë¤¯µ±¤¤¤¿¡ª",
2383 msg_format("%s %s glow%s brightly!",
2384 ((item >= 0) ? "Your" : "The"), o_name,
2385 ((o_ptr->number > 1) ? "" : "s"));
2390 if (enchant(o_ptr, num_hit, ENCH_TOHIT)) okay = TRUE;
2391 if (enchant(o_ptr, num_dam, ENCH_TODAM)) okay = TRUE;
2392 if (enchant(o_ptr, num_ac, ENCH_TOAC)) okay = TRUE;
2398 if (flush_failure) flush();
2402 msg_print("¶¯²½¤Ë¼ºÇÔ¤·¤¿¡£");
2404 msg_print("The enchantment failed.");
2407 if (one_in_(3)) chg_virtue(V_ENCHANT, -1);
2410 chg_virtue(V_ENCHANT, 1);
2414 /* Something happened */
2419 bool artifact_scroll(void)
2424 char o_name[MAX_NLEN];
2428 item_tester_no_ryoute = TRUE;
2429 /* Enchant weapon/armour */
2430 item_tester_hook = item_tester_hook_nameless_weapon_armour;
2434 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò¶¯²½¤·¤Þ¤¹¤«? ";
2435 s = "¶¯²½¤Ç¤¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2437 q = "Enchant which item? ";
2438 s = "You have nothing to enchant.";
2441 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2443 /* Get the item (in the pack) */
2446 o_ptr = &inventory[item];
2449 /* Get the item (on the floor) */
2452 o_ptr = &o_list[0 - item];
2457 object_desc(o_name, o_ptr, FALSE, 0);
2461 msg_format("%s ¤ÏâÁ¤¤¸÷¤òȯ¤·¤¿¡ª",o_name);
2463 msg_format("%s %s radiate%s a blinding light!",
2464 ((item >= 0) ? "Your" : "The"), o_name,
2465 ((o_ptr->number > 1) ? "" : "s"));
2468 if (o_ptr->name1 || o_ptr->art_name)
2471 msg_format("%s¤Ï´û¤ËÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Ç¤¹¡ª",
2474 msg_format("The %s %s already %s!",
2475 o_name, ((o_ptr->number > 1) ? "are" : "is"),
2476 ((o_ptr->number > 1) ? "artifacts" : "an artifact"));
2482 else if (o_ptr->name2)
2485 msg_format("%s¤Ï´û¤Ë̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à¤Ç¤¹¡ª",
2488 msg_format("The %s %s already %s!",
2489 o_name, ((o_ptr->number > 1) ? "are" : "is"),
2490 ((o_ptr->number > 1) ? "ego items" : "an ego item"));
2496 else if (o_ptr->xtra3)
2499 msg_format("%s¤Ï´û¤Ë¶¯²½¤µ¤ì¤Æ¤¤¤Þ¤¹¡ª",
2502 msg_format("The %s %s already %s!",
2503 o_name, ((o_ptr->number > 1) ? "are" : "is"),
2504 ((o_ptr->number > 1) ? "kaji items" : "an kaji item"));
2510 if (o_ptr->number > 1)
2513 msg_print("Ê£¿ô¤Î¥¢¥¤¥Æ¥à¤ËËâË¡¤ò¤«¤±¤ë¤À¤±¤Î¥¨¥Í¥ë¥®¡¼¤Ï¤¢¤ê¤Þ¤»¤ó¡ª");
2514 msg_format("%d ¸Ä¤Î%s¤¬²õ¤ì¤¿¡ª",(o_ptr->number)-1, o_name);
2516 msg_print("Not enough enough energy to enchant more than one object!");
2517 msg_format("%d of your %s %s destroyed!",(o_ptr->number)-1, o_name, (o_ptr->number>2?"were":"was"));
2522 inven_item_increase(item, 1-(o_ptr->number));
2526 floor_item_increase(0-item, 1-(o_ptr->number));
2529 okay = create_artifact(o_ptr, TRUE);
2536 if (flush_failure) flush();
2540 msg_print("¶¯²½¤Ë¼ºÇÔ¤·¤¿¡£");
2542 msg_print("The enchantment failed.");
2545 if (one_in_(3)) chg_virtue(V_ENCHANT, -1);
2548 chg_virtue(V_ENCHANT, 1);
2552 /* Something happened */
2558 * Identify an object
2560 void identify_item(object_type *o_ptr)
2562 bool motoart = TRUE;
2563 char o_name[MAX_NLEN];
2566 object_desc(o_name, o_ptr, TRUE, 3);
2568 if ((artifact_p(o_ptr) || o_ptr->art_name) && !(o_ptr->ident & IDENT_KNOWN))
2571 if (!(o_ptr->ident & (IDENT_MENTAL)))
2573 if ((o_ptr->art_name) || (artifact_p(o_ptr)) || one_in_(5))
2574 chg_virtue(V_KNOWLEDGE, 1);
2577 /* Identify it fully */
2578 object_aware(o_ptr);
2579 object_known(o_ptr);
2581 /* Recalculate bonuses */
2582 p_ptr->update |= (PU_BONUS);
2584 /* Combine / Reorder the pack (later) */
2585 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2588 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2590 strcpy(record_o_name, o_name);
2594 object_desc(o_name, o_ptr, TRUE, 0);
2596 if(record_fix_art && !motoart && artifact_p(o_ptr))
2597 do_cmd_write_nikki(NIKKI_ART, 0, o_name);
2598 if(record_rand_art && !motoart && o_ptr->art_name)
2599 do_cmd_write_nikki(NIKKI_ART, 0, o_name);
2603 bool item_tester_hook_identify(object_type *o_ptr)
2605 return (bool)!object_known_p(o_ptr);
2608 bool item_tester_hook_identify_weapon_armour(object_type *o_ptr)
2610 if (object_known_p(o_ptr))
2612 return item_tester_hook_weapon_armour(o_ptr);
2616 * Identify an object in the inventory (or on the floor)
2617 * This routine does *not* automatically combine objects.
2618 * Returns TRUE if something was identified, else FALSE.
2620 bool ident_spell(bool only_equip)
2624 char o_name[MAX_NLEN];
2627 item_tester_no_ryoute = TRUE;
2630 item_tester_hook = item_tester_hook_identify_weapon_armour;
2632 item_tester_hook = item_tester_hook_identify;
2634 if (!can_get_item())
2638 item_tester_hook = item_tester_hook_weapon_armour;
2642 item_tester_hook = NULL;
2648 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò´ÕÄꤷ¤Þ¤¹¤«? ";
2649 s = "´ÕÄꤹ¤ë¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2651 q = "Identify which item? ";
2652 s = "You have nothing to identify.";
2655 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2657 /* Get the item (in the pack) */
2660 o_ptr = &inventory[item];
2663 /* Get the item (on the floor) */
2666 o_ptr = &o_list[0 - item];
2670 identify_item(o_ptr);
2673 object_desc(o_name, o_ptr, TRUE, 3);
2676 if (item >= INVEN_RARM)
2679 msg_format("%^s: %s(%c)¡£",
2681 msg_format("%^s: %s (%c).",
2684 describe_use(item), o_name, index_to_label(item));
2689 msg_format("¥¶¥Ã¥¯Ãæ: %s(%c)¡£",
2691 msg_format("In your pack: %s (%c).",
2694 o_name, index_to_label(item));
2699 msg_format("¾²¾å: %s¡£",
2701 msg_format("On the ground: %s.",
2707 /* Something happened */
2713 * Mundanify an object in the inventory (or on the floor)
2714 * This routine does *not* automatically combine objects.
2715 * Returns TRUE if something was mundanified, else FALSE.
2717 bool mundane_spell(bool only_equip)
2723 if (only_equip) item_tester_hook = item_tester_hook_weapon_armour;
2724 item_tester_no_ryoute = TRUE;
2728 q = "¤É¤ì¤ò»È¤¤¤Þ¤¹¤«¡©";
2729 s = "»È¤¨¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
2731 q = "Use which item? ";
2732 s = "You have nothing you can use.";
2735 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2737 /* Get the item (in the pack) */
2740 o_ptr = &inventory[item];
2743 /* Get the item (on the floor) */
2746 o_ptr = &o_list[0 - item];
2751 msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
2753 msg_print("There is a bright flash of light!");
2756 byte iy = o_ptr->iy; /* Y-position on map, or zero */
2757 byte ix = o_ptr->ix; /* X-position on map, or zero */
2758 s16b next_o_idx= o_ptr->next_o_idx; /* Next object in stack (if any) */
2759 byte marked=o_ptr->marked; /* Object is marked */
2760 s16b weight = (o_ptr->number*o_ptr->weight);
2763 object_prep(o_ptr, o_ptr->k_idx);
2767 o_ptr->next_o_idx=next_o_idx;
2768 o_ptr->marked=marked;
2769 if (item >= 0) p_ptr->total_weight += (o_ptr->weight - weight);
2773 /* Something happened */
2779 bool item_tester_hook_identify_fully(object_type *o_ptr)
2781 return (bool)(!object_known_p(o_ptr) || !(o_ptr->ident & IDENT_MENTAL));
2784 bool item_tester_hook_identify_fully_weapon_armour(object_type *o_ptr)
2786 if (!item_tester_hook_identify_fully(o_ptr))
2788 return item_tester_hook_weapon_armour(o_ptr);
2792 * Fully "identify" an object in the inventory -BEN-
2793 * This routine returns TRUE if an item was identified.
2795 bool identify_fully(bool only_equip)
2799 char o_name[MAX_NLEN];
2802 item_tester_no_ryoute = TRUE;
2804 item_tester_hook = item_tester_hook_identify_fully_weapon_armour;
2806 item_tester_hook = item_tester_hook_identify_fully;
2808 if (!can_get_item())
2811 item_tester_hook = item_tester_hook_weapon_armour;
2813 item_tester_hook = NULL;
2818 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò´ÕÄꤷ¤Þ¤¹¤«? ";
2819 s = "´ÕÄꤹ¤ë¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2821 q = "Identify which item? ";
2822 s = "You have nothing to identify.";
2825 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2827 /* Get the item (in the pack) */
2830 o_ptr = &inventory[item];
2833 /* Get the item (on the floor) */
2836 o_ptr = &o_list[0 - item];
2840 identify_item(o_ptr);
2842 /* Mark the item as fully known */
2843 o_ptr->ident |= (IDENT_MENTAL);
2849 object_desc(o_name, o_ptr, TRUE, 3);
2852 if (item >= INVEN_RARM)
2855 msg_format("%^s: %s(%c)¡£",
2857 msg_format("%^s: %s (%c).",
2860 describe_use(item), o_name, index_to_label(item));
2865 msg_format("¥¶¥Ã¥¯Ãæ: %s(%c)¡£",
2867 msg_format("In your pack: %s (%c).",
2870 o_name, index_to_label(item));
2875 msg_format("¾²¾å: %s¡£",
2877 msg_format("On the ground: %s.",
2883 /* Describe it fully */
2884 (void)identify_fully_aux(o_ptr);
2894 * Hook for "get_item()". Determine if something is rechargable.
2896 bool item_tester_hook_recharge(object_type *o_ptr)
2898 /* Recharge staffs */
2899 if (o_ptr->tval == TV_STAFF) return (TRUE);
2901 /* Recharge wands */
2902 if (o_ptr->tval == TV_WAND) return (TRUE);
2904 /* Hack -- Recharge rods */
2905 if (o_ptr->tval == TV_ROD) return (TRUE);
2913 * Recharge a wand/staff/rod from the pack or on the floor.
2914 * This function has been rewritten in Oangband and ZAngband.
2916 * Sorcery/Arcane -- Recharge --> recharge(plev * 4)
2917 * Chaos -- Arcane Binding --> recharge(90)
2919 * Scroll of recharging --> recharge(130)
2920 * Artifact activation/Thingol --> recharge(130)
2922 * It is harder to recharge high level, and highly charged wands,
2923 * staffs, and rods. The more wands in a stack, the more easily and
2924 * strongly they recharge. Staffs, however, each get fewer charges if
2927 * XXX XXX XXX Beware of "sliding index errors".
2929 bool recharge(int power)
2932 int recharge_strength, recharge_amount;
2941 char o_name[MAX_NLEN];
2943 /* Only accept legal items */
2944 item_tester_hook = item_tester_hook_recharge;
2948 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ËËâÎϤò½¼Å¶¤·¤Þ¤¹¤«? ";
2949 s = "ËâÎϤò½¼Å¶¤¹¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2951 q = "Recharge which item? ";
2952 s = "You have nothing to recharge.";
2955 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return (FALSE);
2957 /* Get the item (in the pack) */
2960 o_ptr = &inventory[item];
2963 /* Get the item (on the floor) */
2966 o_ptr = &o_list[0 - item];
2969 /* Get the object kind. */
2970 k_ptr = &k_info[o_ptr->k_idx];
2972 /* Extract the object "level" */
2973 lev = get_object_level(o_ptr);
2976 /* Recharge a rod */
2977 if (o_ptr->tval == TV_ROD)
2979 /* Extract a recharge strength by comparing object level to power. */
2980 recharge_strength = ((power > lev/2) ? (power - lev/2) : 0) / 5;
2984 if (one_in_(recharge_strength))
2986 /* Activate the failure code. */
2993 /* Recharge amount */
2994 recharge_amount = (power * damroll(3, 2));
2996 /* Recharge by that amount */
2997 if (o_ptr->timeout > recharge_amount)
2998 o_ptr->timeout -= recharge_amount;
3005 /* Recharge wand/staff */
3008 /* Extract a recharge strength by comparing object level to power.
3009 * Divide up a stack of wands' charges to calculate charge penalty.
3011 if ((o_ptr->tval == TV_WAND) && (o_ptr->number > 1))
3012 recharge_strength = (100 + power - lev -
3013 (8 * o_ptr->pval / o_ptr->number)) / 15;
3015 /* All staffs, unstacked wands. */
3016 else recharge_strength = (100 + power - lev -
3017 (8 * o_ptr->pval)) / 15;
3020 if (recharge_strength < 0) recharge_strength = 0;
3023 if (one_in_(recharge_strength))
3025 /* Activate the failure code. */
3029 /* If the spell didn't backfire, recharge the wand or staff. */
3032 /* Recharge based on the standard number of charges. */
3033 recharge_amount = randint1(1 + k_ptr->pval / 2);
3035 /* Multiple wands in a stack increase recharging somewhat. */
3036 if ((o_ptr->tval == TV_WAND) && (o_ptr->number > 1))
3039 (randint1(recharge_amount * (o_ptr->number - 1))) / 2;
3040 if (recharge_amount < 1) recharge_amount = 1;
3041 if (recharge_amount > 12) recharge_amount = 12;
3044 /* But each staff in a stack gets fewer additional charges,
3045 * although always at least one.
3047 if ((o_ptr->tval == TV_STAFF) && (o_ptr->number > 1))
3049 recharge_amount /= o_ptr->number;
3050 if (recharge_amount < 1) recharge_amount = 1;
3053 /* Recharge the wand or staff. */
3054 o_ptr->pval += recharge_amount;
3057 /* Hack -- we no longer "know" the item */
3058 o_ptr->ident &= ~(IDENT_KNOWN);
3060 /* Hack -- we no longer think the item is empty */
3061 o_ptr->ident &= ~(IDENT_EMPTY);
3066 /* Inflict the penalties for failing a recharge. */
3069 /* Artifacts are never destroyed. */
3070 if (artifact_p(o_ptr))
3072 object_desc(o_name, o_ptr, TRUE, 0);
3074 msg_format("ËâÎϤ¬µÕή¤·¤¿¡ª%s¤Ï´°Á´¤ËËâÎϤò¼º¤Ã¤¿¡£", o_name);
3076 msg_format("The recharging backfires - %s is completely drained!", o_name);
3080 /* Artifact rods. */
3081 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout < 10000))
3082 o_ptr->timeout = (o_ptr->timeout + 100) * 2;
3084 /* Artifact wands and staffs. */
3085 else if ((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_STAFF))
3090 /* Get the object description */
3091 object_desc(o_name, o_ptr, FALSE, 0);
3093 /*** Determine Seriousness of Failure ***/
3095 /* Mages recharge objects more safely. */
3096 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)
3098 /* 10% chance to blow up one rod, otherwise draining. */
3099 if (o_ptr->tval == TV_ROD)
3101 if (one_in_(10)) fail_type = 2;
3104 /* 75% chance to blow up one wand, otherwise draining. */
3105 else if (o_ptr->tval == TV_WAND)
3107 if (!one_in_(3)) fail_type = 2;
3110 /* 50% chance to blow up one staff, otherwise no effect. */
3111 else if (o_ptr->tval == TV_STAFF)
3113 if (one_in_(2)) fail_type = 2;
3118 /* All other classes get no special favors. */
3121 /* 33% chance to blow up one rod, otherwise draining. */
3122 if (o_ptr->tval == TV_ROD)
3124 if (one_in_(3)) fail_type = 2;
3127 /* 20% chance of the entire stack, else destroy one wand. */
3128 else if (o_ptr->tval == TV_WAND)
3130 if (one_in_(5)) fail_type = 3;
3133 /* Blow up one staff. */
3134 else if (o_ptr->tval == TV_STAFF)
3140 /*** Apply draining and destruction. ***/
3142 /* Drain object or stack of objects. */
3145 if (o_ptr->tval == TV_ROD)
3148 msg_print("ËâÎϤ¬µÕÊ®¼Í¤·¤Æ¡¢¥í¥Ã¥É¤«¤é¤µ¤é¤ËËâÎϤòµÛ¤¤¼è¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
3150 msg_print("The recharge backfires, draining the rod further!");
3153 if (o_ptr->timeout < 10000)
3154 o_ptr->timeout = (o_ptr->timeout + 100) * 2;
3156 else if (o_ptr->tval == TV_WAND)
3159 msg_format("%s¤ÏÇË»¤òÌȤ줿¤¬¡¢ËâÎϤ¬Á´¤Æ¼º¤ï¤ì¤¿¡£", o_name);
3161 msg_format("You save your %s from destruction, but all charges are lost.", o_name);
3166 /* Staffs aren't drained. */
3169 /* Destroy an object or one in a stack of objects. */
3172 if (o_ptr->number > 1)
3174 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬°ìËܲõ¤ì¤¿¡ª", o_name);
3176 msg_format("Wild magic consumes one of your %s!", o_name);
3181 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²õ¤ì¤¿¡ª", o_name);
3183 msg_format("Wild magic consumes your %s!", o_name);
3187 /* Reduce rod stack maximum timeout, drain wands. */
3188 if (o_ptr->tval == TV_ROD) o_ptr->timeout = (o_ptr->number - 1) * k_ptr->pval;
3189 if (o_ptr->tval == TV_WAND) o_ptr->pval = 0;
3191 /* Reduce and describe inventory */
3194 inven_item_increase(item, -1);
3195 inven_item_describe(item);
3196 inven_item_optimize(item);
3199 /* Reduce and describe floor item */
3202 floor_item_increase(0 - item, -1);
3203 floor_item_describe(0 - item);
3204 floor_item_optimize(0 - item);
3208 /* Destroy all members of a stack of objects. */
3211 if (o_ptr->number > 1)
3213 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬Á´¤Æ²õ¤ì¤¿¡ª", o_name);
3215 msg_format("Wild magic consumes all your %s!", o_name);
3220 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²õ¤ì¤¿¡ª", o_name);
3222 msg_format("Wild magic consumes your %s!", o_name);
3227 /* Reduce and describe inventory */
3230 inven_item_increase(item, -999);
3231 inven_item_describe(item);
3232 inven_item_optimize(item);
3235 /* Reduce and describe floor item */
3238 floor_item_increase(0 - item, -999);
3239 floor_item_describe(0 - item);
3240 floor_item_optimize(0 - item);
3246 /* Combine / Reorder the pack (later) */
3247 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
3250 p_ptr->window |= (PW_INVEN);
3252 /* Something was done */
3260 bool bless_weapon(void)
3265 char o_name[MAX_NLEN];
3268 item_tester_no_ryoute = TRUE;
3269 /* Assume enchant weapon */
3270 item_tester_hook = item_tester_hook_weapon2;
3274 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò½ËÊ¡¤·¤Þ¤¹¤«¡©";
3275 s = "½ËÊ¡¤Ç¤¤ëÉð´ï¤¬¤¢¤ê¤Þ¤»¤ó¡£";
3277 q = "Bless which weapon? ";
3278 s = "You have weapon to bless.";
3281 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR)))
3284 /* Get the item (in the pack) */
3287 o_ptr = &inventory[item];
3290 /* Get the item (on the floor) */
3293 o_ptr = &o_list[0 - item];
3298 object_desc(o_name, o_ptr, FALSE, 0);
3300 /* Extract the flags */
3301 object_flags(o_ptr, &f1, &f2, &f3);
3303 if (cursed_p(o_ptr))
3305 if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && (randint1(100) < 33)) ||
3306 (o_ptr->curse_flags & TRC_PERMA_CURSE))
3309 msg_format("%s¤òʤ¤¦¹õ¤¤¥ª¡¼¥é¤Ï½ËÊ¡¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
3312 msg_format("The black aura on %s %s disrupts the blessing!",
3313 ((item >= 0) ? "your" : "the"), o_name);
3320 msg_format("%s ¤«¤é¼Ù°¤Ê¥ª¡¼¥é¤¬¾Ã¤¨¤¿¡£",
3323 msg_format("A malignant aura leaves %s %s.",
3324 ((item >= 0) ? "your" : "the"), o_name);
3329 o_ptr->curse_flags = 0L;
3331 /* Hack -- Assume felt */
3332 o_ptr->ident |= (IDENT_SENSE);
3335 o_ptr->feeling = FEEL_NONE;
3337 /* Recalculate the bonuses */
3338 p_ptr->update |= (PU_BONUS);
3341 p_ptr->window |= (PW_EQUIP);
3345 * Next, we try to bless it. Artifacts have a 1/3 chance of
3346 * being blessed, otherwise, the operation simply disenchants
3347 * them, godly power negating the magic. Ok, the explanation
3348 * is silly, but otherwise priests would always bless every
3349 * artifact weapon they find. Ego weapons and normal weapons
3350 * can be blessed automatically.
3352 if (f3 & TR3_BLESSED)
3355 msg_format("%s ¤Ï´û¤Ë½ËÊ¡¤µ¤ì¤Æ¤¤¤ë¡£",
3358 msg_format("%s %s %s blessed already.",
3359 ((item >= 0) ? "Your" : "The"), o_name,
3360 ((o_ptr->number > 1) ? "were" : "was"));
3366 if (!(o_ptr->art_name || o_ptr->name1 || o_ptr->name2) || one_in_(3))
3370 msg_format("%s¤Ïµ±¤¤¤¿¡ª",
3373 msg_format("%s %s shine%s!",
3374 ((item >= 0) ? "Your" : "The"), o_name,
3375 ((o_ptr->number > 1) ? "" : "s"));
3378 o_ptr->art_flags3 |= TR3_BLESSED;
3379 o_ptr->discount = 99;
3383 bool dis_happened = FALSE;
3386 msg_print("¤½¤ÎÉð´ï¤Ï½ËÊ¡¤ò·ù¤Ã¤Æ¤¤¤ë¡ª");
3388 msg_print("The weapon resists your blessing!");
3392 /* Disenchant tohit */
3393 if (o_ptr->to_h > 0)
3396 dis_happened = TRUE;
3399 if ((o_ptr->to_h > 5) && (randint0(100) < 33)) o_ptr->to_h--;
3401 /* Disenchant todam */
3402 if (o_ptr->to_d > 0)
3405 dis_happened = TRUE;
3408 if ((o_ptr->to_d > 5) && (randint0(100) < 33)) o_ptr->to_d--;
3410 /* Disenchant toac */
3411 if (o_ptr->to_a > 0)
3414 dis_happened = TRUE;
3417 if ((o_ptr->to_a > 5) && (randint0(100) < 33)) o_ptr->to_a--;
3422 msg_print("¼þ°Ï¤¬ËÞÍǤÊÊ·°Ïµ¤¤ÇËþ¤Á¤¿...");
3424 msg_print("There is a static feeling in the air...");
3428 msg_format("%s ¤ÏÎô²½¤·¤¿¡ª",
3431 msg_format("%s %s %s disenchanted!",
3432 ((item >= 0) ? "Your" : "The"), o_name,
3433 ((o_ptr->number > 1) ? "were" : "was"));
3439 /* Recalculate bonuses */
3440 p_ptr->update |= (PU_BONUS);
3443 p_ptr->window |= (PW_EQUIP | PW_PLAYER);
3454 bool pulish_shield(void)
3459 char o_name[MAX_NLEN];
3462 item_tester_no_ryoute = TRUE;
3463 /* Assume enchant weapon */
3464 item_tester_tval = TV_SHIELD;
3468 q = "¤É¤Î½â¤òËᤤޤ¹¤«¡©";
3469 s = "Ë᤯½â¤¬¤¢¤ê¤Þ¤»¤ó¡£";
3471 q = "Pulish which weapon? ";
3472 s = "You have weapon to pulish.";
3475 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR)))
3478 /* Get the item (in the pack) */
3481 o_ptr = &inventory[item];
3484 /* Get the item (on the floor) */
3487 o_ptr = &o_list[0 - item];
3492 object_desc(o_name, o_ptr, FALSE, 0);
3494 /* Extract the flags */
3495 object_flags(o_ptr, &f1, &f2, &f3);
3497 if (o_ptr->k_idx && !artifact_p(o_ptr) && !ego_item_p(o_ptr) &&
3498 !o_ptr->art_name && !cursed_p(o_ptr) && (o_ptr->sval != SV_SHIELD_OF_DEFLECTION))
3501 msg_format("%s¤Ïµ±¤¤¤¿¡ª", o_name);
3503 msg_format("%s %s shine%s!",
3504 ((item >= 0) ? "Your" : "The"), o_name,
3505 ((o_ptr->number > 1) ? "" : "s"));
3507 o_ptr->name2 = EGO_REFLECTION;
3508 enchant(o_ptr, randint0(3) + 4, ENCH_TOAC);
3510 o_ptr->discount = 99;
3511 chg_virtue(V_ENCHANT, 2);
3517 if (flush_failure) flush();
3520 msg_print("¼ºÇÔ¤·¤¿¡£");
3522 msg_print("Failed.");
3525 chg_virtue(V_ENCHANT, -2);
3534 * Potions "smash open" and cause an area effect when
3535 * (1) they are shattered while in the player's inventory,
3536 * due to cold (etc) attacks;
3537 * (2) they are thrown at a monster, or obstacle;
3538 * (3) they are shattered by a "cold ball" or other such spell
3539 * while lying on the floor.
3542 * who --- who caused the potion to shatter (0=player)
3543 * potions that smash on the floor are assumed to
3544 * be caused by no-one (who = 1), as are those that
3545 * shatter inside the player inventory.
3546 * (Not anymore -- I changed this; TY)
3547 * y, x --- coordinates of the potion (or player if
3548 * the potion was in her inventory);
3549 * o_ptr --- pointer to the potion object.
3551 bool potion_smash_effect(int who, int y, int x, int k_idx)
3559 object_kind *k_ptr = &k_info[k_idx];
3561 switch (k_ptr->sval)
3563 case SV_POTION_SALT_WATER:
3564 case SV_POTION_SLIME_MOLD:
3565 case SV_POTION_LOSE_MEMORIES:
3566 case SV_POTION_DEC_STR:
3567 case SV_POTION_DEC_INT:
3568 case SV_POTION_DEC_WIS:
3569 case SV_POTION_DEC_DEX:
3570 case SV_POTION_DEC_CON:
3571 case SV_POTION_DEC_CHR:
3572 case SV_POTION_WATER: /* perhaps a 'water' attack? */
3573 case SV_POTION_APPLE_JUICE:
3576 case SV_POTION_INFRAVISION:
3577 case SV_POTION_DETECT_INVIS:
3578 case SV_POTION_SLOW_POISON:
3579 case SV_POTION_CURE_POISON:
3580 case SV_POTION_BOLDNESS:
3581 case SV_POTION_RESIST_HEAT:
3582 case SV_POTION_RESIST_COLD:
3583 case SV_POTION_HEROISM:
3584 case SV_POTION_BESERK_STRENGTH:
3585 case SV_POTION_RES_STR:
3586 case SV_POTION_RES_INT:
3587 case SV_POTION_RES_WIS:
3588 case SV_POTION_RES_DEX:
3589 case SV_POTION_RES_CON:
3590 case SV_POTION_RES_CHR:
3591 case SV_POTION_INC_STR:
3592 case SV_POTION_INC_INT:
3593 case SV_POTION_INC_WIS:
3594 case SV_POTION_INC_DEX:
3595 case SV_POTION_INC_CON:
3596 case SV_POTION_INC_CHR:
3597 case SV_POTION_AUGMENTATION:
3598 case SV_POTION_ENLIGHTENMENT:
3599 case SV_POTION_STAR_ENLIGHTENMENT:
3600 case SV_POTION_SELF_KNOWLEDGE:
3601 case SV_POTION_EXPERIENCE:
3602 case SV_POTION_RESISTANCE:
3603 case SV_POTION_INVULNERABILITY:
3604 case SV_POTION_NEW_LIFE:
3605 /* All of the above potions have no effect when shattered */
3607 case SV_POTION_SLOWNESS:
3613 case SV_POTION_POISON:
3619 case SV_POTION_BLINDNESS:
3624 case SV_POTION_CONFUSION: /* Booze */
3629 case SV_POTION_SLEEP:
3634 case SV_POTION_RUINATION:
3635 case SV_POTION_DETONATIONS:
3637 dam = damroll(25, 25);
3641 case SV_POTION_DEATH:
3642 dt = GF_DEATH_RAY; /* !! */
3643 dam = k_ptr->level * 10;
3648 case SV_POTION_SPEED:
3652 case SV_POTION_CURE_LIGHT:
3654 dam = damroll(2, 3);
3657 case SV_POTION_CURE_SERIOUS:
3659 dam = damroll(4, 3);
3662 case SV_POTION_CURE_CRITICAL:
3663 case SV_POTION_CURING:
3665 dam = damroll(6, 3);
3668 case SV_POTION_HEALING:
3670 dam = damroll(10, 10);
3673 case SV_POTION_RESTORE_EXP:
3679 case SV_POTION_LIFE:
3681 dam = damroll(50, 50);
3685 case SV_POTION_STAR_HEALING:
3687 dam = damroll(50, 50);
3691 case SV_POTION_RESTORE_MANA: /* MANA */
3693 dam = damroll(10, 10);
3701 (void)project(who, radius, y, x, dam, dt,
3702 (PROJECT_JUMP | PROJECT_ITEM | PROJECT_KILL), -1);
3704 /* XXX those potions that explode need to become "known" */
3710 * Hack -- Display all known spells in a window
3712 * XXX XXX XXX Need to analyze size of the window.
3714 * XXX XXX XXX Need more color coding.
3716 void display_spell_list(void)
3720 int use_realm1 = p_ptr->realm1 - 1;
3721 int use_realm2 = p_ptr->realm2 - 1;
3731 /* Warriors are illiterate */
3732 if (!mp_ptr->spell_book) return;
3733 if (p_ptr->pclass == CLASS_SORCERER) return;
3734 if (p_ptr->pclass == CLASS_RED_MAGE) return;
3736 /* Mindcrafter spell-list */
3737 if ((p_ptr->pclass == CLASS_MINDCRAFTER) || (p_ptr->pclass == CLASS_FORCETRAINER))
3743 int plev = p_ptr->lev;
3750 /* Display a list of spells */
3753 put_str("̾Á°", y, x + 5);
3754 put_str("Lv MP ¼ºÎ¨ ¸ú²Ì", y, x + 35);
3756 put_str("Name", y, x + 5);
3757 put_str("Lv Mana Fail Info", y, x + 35);
3760 switch(p_ptr->pclass)
3762 case CLASS_MINDCRAFTER: use_mind = MIND_MINDCRAFTER;break;
3763 case CLASS_FORCETRAINER: use_mind = MIND_KI;break;
3764 default: use_mind = 0;break;
3767 /* Dump the spells */
3768 for (i = 0; i < MAX_MIND_POWERS; i++)
3770 byte a = TERM_WHITE;
3772 /* Access the available spell */
3773 spell = mind_powers[use_mind].info[i];
3774 if (spell.min_lev > plev) break;
3776 /* Get the failure rate */
3777 chance = spell.fail;
3779 /* Reduce failure rate by "effective" level adjustment */
3780 chance -= 3 * (p_ptr->lev - spell.min_lev);
3782 /* Reduce failure rate by INT/WIS adjustment */
3783 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
3785 /* Not enough mana to cast */
3786 if (spell.mana_cost > p_ptr->csp)
3788 chance += 5 * (spell.mana_cost - p_ptr->csp);
3792 /* Extract the minimum failure rate */
3793 minfail = adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]];
3795 /* Minimum failure rate */
3796 if (chance < minfail) chance = minfail;
3798 /* Stunning makes spells harder */
3799 if (p_ptr->stun > 50) chance += 25;
3800 else if (p_ptr->stun) chance += 15;
3802 /* Always a 5 percent chance of working */
3803 if (chance > 95) chance = 95;
3806 mindcraft_info(comment, use_mind, i);
3808 /* Dump the spell */
3809 sprintf(psi_desc, " %c) %-30s%2d %4d %3d%%%s",
3811 spell.min_lev, spell.mana_cost, chance, comment);
3813 Term_putstr(x, y + i + 1, -1, a, psi_desc);
3818 /* Normal spellcaster with books */
3821 for (j = 0; j < ((use_realm2 > -1) ? 2 : 1); j++)
3825 /* Reset vertical */
3828 /* Vertical location */
3829 y = (j < 3) ? 0 : (m[j - 3] + 2);
3831 /* Horizontal location */
3835 for (i = 0; i < 32; i++)
3837 byte a = TERM_WHITE;
3839 /* Access the spell */
3840 if (!is_magic((j < 1) ? use_realm1 : use_realm2))
3842 s_ptr = &technic_info[(j < 1) ? use_realm1 : use_realm2 - MIN_TECHNIC][i % 32];
3846 s_ptr = &mp_ptr->info[(j < 1) ? use_realm1 : use_realm2][i % 32];
3849 strcpy(name, spell_names[technic2magic((j < 1) ? use_realm1+1 : use_realm2+1)-1][i % 32]);
3852 if (s_ptr->slevel >= 99)
3856 strcpy(name, "(ȽÆÉÉÔǽ)");
3858 strcpy(name, "(illegible)");
3868 ((spell_forgotten1 & (1L << i))) :
3869 ((spell_forgotten2 & (1L << (i % 32)))))
3876 else if (!((j < 1) ?
3877 (spell_learned1 & (1L << i)) :
3878 (spell_learned2 & (1L << (i % 32)))))
3885 else if (!((j < 1) ?
3886 (spell_worked1 & (1L << i)) :
3887 (spell_worked2 & (1L << (i % 32)))))
3893 /* Dump the spell --(-- */
3894 sprintf(out_val, "%c/%c) %-20.20s",
3895 I2A(n / 8), I2A(n % 8), name);
3900 /* Dump onto the window */
3901 Term_putstr(x, m[j], -1, a, out_val);
3912 * Returns spell chance of failure for spell -RAK-
3914 s16b spell_chance(int spell, int realm)
3916 int chance, minfail;
3919 int penalty = (mp_ptr->spell_stat == A_WIS) ? 10 : 4;
3922 /* Paranoia -- must be literate */
3923 if (!mp_ptr->spell_book) return (100);
3925 if (realm+1 == REALM_HISSATSU) return 0;
3927 /* Access the spell */
3928 if (!is_magic(realm+1))
3930 s_ptr = &technic_info[realm - MIN_TECHNIC][spell];
3934 s_ptr = &mp_ptr->info[realm][spell];
3937 /* Extract the base spell failure rate */
3938 chance = s_ptr->sfail;
3940 /* Reduce failure rate by "effective" level adjustment */
3941 chance -= 3 * (p_ptr->lev - s_ptr->slevel);
3943 /* Reduce failure rate by INT/WIS adjustment */
3944 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
3947 chance += (MAX(r_info[m_list[p_ptr->riding].r_idx].level-skill_exp[GINOU_RIDING]/100-10,0));
3949 if (p_ptr->pclass == CLASS_SORCERER)
3950 shouhimana = s_ptr->smana*2200 + 2399;
3951 else if (p_ptr->pclass == CLASS_RED_MAGE)
3952 shouhimana = s_ptr->smana*2600 + 2399;
3953 else if ((realm+1 == p_ptr->realm1) || (realm+1 == p_ptr->realm2))
3954 shouhimana = (s_ptr->smana*(3800-spell_exp[((p_ptr->realm1 == realm+1) ? spell: spell+32)])+2399);
3955 else shouhimana = s_ptr->smana*3800;
3958 else shouhimana *= 4;
3960 if(shouhimana < 1) shouhimana = 1;
3962 /* Not enough mana to cast */
3963 if (shouhimana > p_ptr->csp)
3965 chance += 5 * (shouhimana - p_ptr->csp);
3968 chance += p_ptr->to_m_chance;
3969 if (((realm + 1) != p_ptr->realm1) && ((p_ptr->pclass == CLASS_MAGE) || (p_ptr->pclass == CLASS_PRIEST))) chance += 5;
3971 /* Extract the minimum failure rate */
3972 minfail = adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]];
3975 * Non mage/priest characters never get too good
3976 * (added high mage, mindcrafter)
3978 if (mp_ptr->spell_xtra & MAGIC_FAIL_5PERCENT)
3980 if (minfail < 5) minfail = 5;
3983 /* Hack -- Priest prayer penalty for "edged" weapons -DGK */
3984 if (((p_ptr->pclass == CLASS_PRIEST) || (p_ptr->pclass == CLASS_SORCERER)) && p_ptr->icky_wield[0]) chance += 25;
3985 if (((p_ptr->pclass == CLASS_PRIEST) || (p_ptr->pclass == CLASS_SORCERER)) && p_ptr->icky_wield[1]) chance += 25;
3987 if (p_ptr->heavy_spell) chance += 20;
3988 if(p_ptr->dec_mana && p_ptr->easy_spell) chance-=4;
3989 else if (p_ptr->easy_spell) chance-=3;
3990 else if (p_ptr->dec_mana) chance-=2;
3992 if ((realm+1 == REALM_NATURE) && ((p_ptr->align > 50) || (p_ptr->align < -50))) chance += penalty;
3993 if ((realm+1 == REALM_LIFE) && (p_ptr->align < -20)) chance += penalty;
3994 if (((realm+1 == REALM_DEATH) || (realm+1 == REALM_DAEMON)) && (p_ptr->align > 20)) chance += penalty;
3996 /* Minimum failure rate */
3997 if (chance < minfail) chance = minfail;
3999 /* Stunning makes spells harder */
4000 if (p_ptr->stun > 50) chance += 25;
4001 else if (p_ptr->stun) chance += 15;
4003 /* Always a 5 percent chance of working */
4004 if (chance > 95) chance = 95;
4006 if ((realm+1 == p_ptr->realm1) || (realm+1 == p_ptr->realm2))
4008 if(spell_exp[((p_ptr->realm1 == realm+1) ? spell: spell+32)]>1399) chance--;
4009 if(spell_exp[((p_ptr->realm1 == realm+1) ? spell: spell+32)]>1599) chance--;
4011 if(p_ptr->dec_mana) chance--;
4012 if (p_ptr->heavy_spell) chance += 5;
4014 chance = MAX(chance,0);
4016 /* Return the chance */
4023 * Determine if a spell is "okay" for the player to cast or study
4024 * The spell must be legible, not forgotten, and also, to cast,
4025 * it must be known, and to study, it must not be known.
4027 bool spell_okay(int spell, bool learned, bool study_pray, int realm)
4031 /* Access the spell */
4032 if (!is_magic(realm+1))
4034 s_ptr = &technic_info[realm - MIN_TECHNIC][spell];
4038 s_ptr = &mp_ptr->info[realm][spell];
4041 /* Spell is illegal */
4042 if (s_ptr->slevel > p_ptr->lev) return (FALSE);
4044 /* Spell is forgotten */
4045 if ((realm == p_ptr->realm2 - 1) ?
4046 (spell_forgotten2 & (1L << spell)) :
4047 (spell_forgotten1 & (1L << spell)))
4053 if (p_ptr->pclass == CLASS_SORCERER) return (TRUE);
4054 if (p_ptr->pclass == CLASS_RED_MAGE) return (TRUE);
4056 /* Spell is learned */
4057 if ((realm == p_ptr->realm2 - 1) ?
4058 (spell_learned2 & (1L << spell)) :
4059 (spell_learned1 & (1L << spell)))
4062 return (!study_pray);
4065 /* Okay to study, not to cast */
4072 * Extra information on a spell -DRS-
4074 * We can use up to 14 characters of the buffer 'p'
4076 * The strings in this function were extracted from the code in the
4077 * functions "do_cmd_cast()" and "do_cmd_pray()" and may be dated.
4079 static void spell_info(char *p, int spell, int realm)
4081 int plev = p_ptr->lev;
4084 int orb = plev + (plev / ((p_ptr->pclass == CLASS_PRIEST ||
4085 p_ptr->pclass == CLASS_HIGH_MAGE ||
4086 p_ptr->pclass == CLASS_SORCERER) ? 2 : 4));
4088 int burst = plev + (plev / ((p_ptr->pclass == CLASS_MAGE ||
4089 p_ptr->pclass == CLASS_HIGH_MAGE ||
4090 p_ptr->pclass == CLASS_SORCERER) ? 2 : 4));
4092 cptr s_dam = "»½ý:";
4093 cptr s_dur = "´ü´Ö:";
4094 cptr s_range = "ÈÏ°Ï:";
4095 cptr s_heal = "²óÉü:";
4096 cptr s_random = "¥é¥ó¥À¥à";
4097 cptr s_delay = "ÃÙ±ä:";
4099 cptr s_dam = "dam ";
4100 cptr s_dur = "dur ";
4101 cptr s_range = "range ";
4102 cptr s_heal = "heal ";
4103 cptr s_random = "random";
4104 cptr s_delay = "delay ";
4109 /* Analyze the spell */
4115 case 1: sprintf(p, " %s2d10", s_heal); break;
4116 case 2: sprintf(p, " %s12+d12", s_dur); break;
4117 case 4: sprintf(p, " %s%d", s_dam, 10 + (plev / 2)); break;
4118 case 6: sprintf(p, " %s4d10", s_heal); break;
4119 case 10: sprintf(p, " %s8d10", s_heal); break;
4120 case 11: sprintf(p, " %s24+d24", s_dur); break;
4121 case 12: sprintf(p, " %s3d6+%d", s_dam, orb); break;
4122 case 13: sprintf(p, " %sd25+%d", s_dur, 3 * plev); break;
4123 case 14: sprintf(p, " %s300", s_heal); break;
4124 case 16: sprintf(p, " %sd%d", s_dam, plev); break;
4125 case 18: sprintf(p, " %sd%d", s_dam, 3 * plev); break;
4126 case 20: sprintf(p, " %sd%d", s_dam, 4 * plev); break;
4128 case 22: sprintf(p, " »:d%d/²ó:1000", 4 * plev); break;
4130 case 22: sprintf(p, " d %d/h 1000", 4 * plev); break;
4132 case 24: sprintf(p, " %s25+d25", s_dur); break;
4133 case 25: sprintf(p, " %s48+d48", s_dur); break;
4134 case 28: sprintf(p, " %s2000", s_heal); break;
4136 case 30: sprintf(p, " ²ó300/»%d+250", plev * 4); break;
4138 case 30: sprintf(p, " h300/d%d+250", plev * 4); break;
4140 case 31: sprintf(p, " %s%d+d%d", s_dur,(plev/2), (plev/2)); break;
4144 case 1: /* Sorcery */
4147 case 1: sprintf(p, " %s10", s_range); break;
4148 case 3: sprintf(p, " %s%d", s_dam, 10 + (plev / 2)); break;
4149 case 5: sprintf(p, " %s%d", s_range, plev * 5); break;
4150 case 13: sprintf(p, " %s%d+d%d", s_dur, plev, plev + 20); break;
4151 case 18: sprintf(p, " %s25+d30", s_dur); break;
4152 case 22: sprintf(p, " %s15+d21", s_delay); break;
4153 case 23: sprintf(p, " %s%d", s_range, plev / 2 + 10); break;
4154 case 25: sprintf(p, " %s7d7+%d", s_dam, plev); break;
4156 case 26: sprintf(p, " ºÇÂç½ÅÎÌ:%d.%dkg", lbtokg1(plev * 15),lbtokg2(plev * 15)); break;
4158 case 26: sprintf(p, " max wgt %d", plev * 15 / 10); break;
4160 case 27: sprintf(p, " %s25+d30", s_dur); break;
4161 case 31: sprintf(p, " %s4+d4", s_dur); break;
4165 case 2: /* Nature */
4169 case 1: sprintf(p, " %s%dd4 ¼ÍÄø%d", s_dam, (3 + ((plev - 1) / 5)), plev/6+2); break;
4171 case 1: sprintf(p, " %s%dd4 rng %d", s_dam, (3 + ((plev - 1) / 5)), plev/6+2); break;
4173 case 4: sprintf(p, " %s%d", s_dam, 10 + (plev / 2)); break;
4174 case 6: sprintf(p, " %s20+d20", s_dur); break;
4175 case 7: sprintf(p, " %s2d8", s_heal); break;
4176 case 9: sprintf(p, " %s%dd8", s_dam, (3 + ((plev - 5) / 4))); break;
4177 case 11: sprintf(p, " %s%dd8", s_dam, (5 + ((plev - 5) / 4))); break;
4178 case 12: sprintf(p, " %s6d8", s_dam); break;
4179 case 15: sprintf(p, " %s500", s_heal); break;
4180 case 17: sprintf(p, " %s20+d30", s_dur); break;
4181 case 18: sprintf(p, " %s20+d20", s_dur); break;
4183 case 24: sprintf(p, " Ⱦ·Â:10"); break;
4185 case 24: sprintf(p, " rad 10"); break;
4187 case 26: sprintf(p, " %s%d", s_dam, 70 + plev * 3 / 2); break;
4188 case 27: sprintf(p, " %s%d", s_dam, 90 + plev * 3 / 2); break;
4189 case 28: sprintf(p, " %s%d", s_dam, 100 + plev * 3 / 2); break;
4190 case 29: sprintf(p, " %s75", s_dam); break;
4191 case 31: sprintf(p, " %s%d+%d", s_dam, 4 * plev, 100 + plev); break;
4198 case 0: sprintf(p, " %s%dd4", s_dam, 3 + ((plev - 1) / 5)); break;
4199 case 2: sprintf(p, " %s%d", s_dam, 10 + (plev / 2)); break;
4200 case 4: sprintf(p, " %s3d5+%d", s_dam, burst); break;
4201 case 5: sprintf(p, " %s%dd8", s_dam, (6 + ((plev - 5) / 4))); break;
4202 case 6: sprintf(p, " %s%dd8", s_dam, (8 + ((plev - 5) / 4))); break;
4203 case 7: sprintf(p, " %s%d", s_range, plev * 5); break;
4204 case 8: sprintf(p, " %s", s_random); break;
4205 case 9: sprintf(p, " %s%dd8", s_dam, (10 + ((plev - 5) / 4))); break;
4206 case 10: sprintf(p, " %s%d", s_dam, (60 + plev)/2); break;
4207 case 11: sprintf(p, " %s%dd8", s_dam, (11 + ((plev - 5) / 4))); break;
4208 case 12: sprintf(p, " %s%d", s_dam, 55 + plev); break;
4209 case 15: sprintf(p, " %s%d", s_dam, 99 + plev*2); break;
4210 case 17: sprintf(p, " %s%dd8", s_dam, (5 + (plev / 10))); break;
4211 case 19: sprintf(p, " %s%d", s_dam, 70 + plev); break;
4212 case 21: sprintf(p, " %s%d", s_dam, 120 + plev*2); break;
4213 case 24: sprintf(p, " %s%dd8", s_dam, (9 + (plev / 10))); break;
4215 case 25: sprintf(p, " %s³Æ%d", s_dam, plev * 2); break;
4217 case 25: sprintf(p, " dam %d each", plev * 2); break;
4219 case 26: sprintf(p, " %s%d", s_dam, 150 + plev*3/2); break;
4220 case 27: sprintf(p, " %s150 / 250", s_dam); break;
4221 case 29: sprintf(p, " %s%d", s_dam, 300 + (plev * 4)); break;
4222 case 30: sprintf(p, " %s%d", s_dam, p_ptr->chp); break;
4223 case 31: sprintf(p, " %s3 * 175", s_dam); break;
4230 case 1: sprintf(p, " %s%dd3", s_dam, (3 + ((plev - 1) / 5))); break;
4231 case 3: sprintf(p, " %s%d", s_dam, 10 + (plev / 2)); break;
4232 case 5: sprintf(p, " %s20+d20", s_dur); break;
4233 case 8: sprintf(p, " %s3d6+%d", s_dam, burst); break;
4234 case 9: sprintf(p, " %s%dd8", s_dam, (8 + ((plev - 5) / 4))); break;
4235 case 10: sprintf(p, " %s%d", s_dam, 30+plev); break;
4237 case 13: sprintf(p, " »:%d+d%d", plev * 2, plev * 2); break;
4239 case 13: sprintf(p, " d %d+d%d", plev * 2, plev * 2); break;
4241 case 16: sprintf(p, " %s25+d25", s_dur); break;
4242 case 17: sprintf(p, " %s", s_random); break;
4243 case 18: sprintf(p, " %s%dd8", s_dam, (4 + ((plev - 5) / 4))); break;
4244 case 19: sprintf(p, " %s25+d25", s_dur); break;
4245 case 21: sprintf(p, " %s3*100", s_dam); break;
4246 case 22: sprintf(p, " %sd%d", s_dam, plev * 3); break;
4247 case 23: sprintf(p, " %s%d", s_dam, 100 + plev * 2); break;
4248 case 27: sprintf(p, " %s%d+d%d", s_dur,10+plev/2, 10+plev/2); break;
4249 case 30: sprintf(p, " %s666", s_dam); break;
4250 case 31: sprintf(p, " %s%d+d%d", s_dur, (plev / 2), (plev / 2)); break;
4257 case 0: sprintf(p, " %s10", s_range); break;
4258 case 2: sprintf(p, " %s", s_random); break;
4259 case 4: sprintf(p, " %s%d", s_range, plev * 4); break;
4260 case 5: sprintf(p, " %s25+d30", s_dur); break;
4262 case 8: sprintf(p, " ºÇÂç½ÅÎÌ:%d.%d", lbtokg1(plev * 15 / 10),lbtokg2(plev * 15 / 10)); break;
4264 case 8: sprintf(p, " max wgt %d", plev * 15 / 10); break;
4266 case 13: sprintf(p, " %s%d", s_range, plev / 2 + 10); break;
4267 case 14: sprintf(p, " %s15+d21", s_delay); break;
4268 case 26: sprintf(p, " %s%d", s_heal, plev * 10 + 200); break;
4270 case 28: sprintf(p, " %s³Æ%d", s_dam, plev * 2); break;
4272 case 28: sprintf(p, " dam %d each", plev * 2); break;
4277 case 6: /* Arcane */
4280 case 0: sprintf(p, " %s%dd3", s_dam, 3 + ((plev - 1) / 5)); break;
4281 case 4: sprintf(p, " %s10", s_range); break;
4282 case 5: sprintf(p, " %s2d%d", s_dam, plev / 2); break;
4283 case 7: sprintf(p, " %s2d8", s_heal); break;
4287 case 17: sprintf(p, " %s20+d20", s_dur); break;
4288 case 18: sprintf(p, " %s4d8", s_heal); break;
4289 case 19: sprintf(p, " %s%d", s_range, plev * 5); break;
4290 case 21: sprintf(p, " %s6d8", s_dam); break;
4291 case 24: sprintf(p, " %s24+d24", s_dur); break;
4292 case 28: sprintf(p, " %s%d", s_dam, 75 + plev); break;
4293 case 30: sprintf(p, " %s15+d21", s_delay); break;
4294 case 31: sprintf(p, " %s25+d30", s_dur); break;
4301 case 0: sprintf(p, " %s100+d100", s_dur); break;
4302 case 1: sprintf(p, " %s80+d80", s_dur); break;
4308 case 18: sprintf(p, " %s20+d20", s_dur); break;
4309 case 5: sprintf(p, " %s25+d25", s_dur); break;
4310 case 8: sprintf(p, " %s24+d24", s_dur); break;
4311 case 11: sprintf(p, " %s25+d25", s_dur); break;
4312 case 13: sprintf(p, " %s%d+d25", s_dur, plev * 3); break;
4313 case 15: sprintf(p, " %s%d+d%d", s_dur, plev/2, plev/2); break;
4314 case 16: sprintf(p, " %s25+d30", s_dur); break;
4315 case 17: sprintf(p, " %s30+d20", s_dur); break;
4316 case 19: sprintf(p, " %s%d+d%d", s_dur, plev+20, plev); break;
4317 case 20: sprintf(p, " %s50+d50", s_dur); break;
4318 case 23: sprintf(p, " %s20+d20", s_dur); break;
4319 case 31: sprintf(p, " %s13+d13", s_dur); break;
4323 case 8: /* Daemon */
4326 case 0: sprintf(p, " %s%dd4", s_dam, 3 + ((plev - 1) / 5)); break;
4327 case 2: sprintf(p, " %s12+d12", s_dur); break;
4328 case 3: sprintf(p, " %s20+d20", s_dur); break;
4329 case 5: sprintf(p, " %s%dd8", s_dam, (6 + ((plev - 5) / 4))); break;
4330 case 7: sprintf(p, " %s3d6+%d", s_dam, burst); break;
4331 case 10: sprintf(p, " %s20+d20", s_dur); break;
4332 case 11: sprintf(p, " %s%dd8", s_dam, (11 + ((plev - 5) / 4))); break;
4333 case 12: sprintf(p, " %s%d", s_dam, 55 + plev); break;
4334 case 14: sprintf(p, " %s%d", s_dam, 100 + plev*3/2); break;
4335 case 16: sprintf(p, " %s30+d25", s_dur); break;
4336 case 17: sprintf(p, " %s20+d20", s_dur); break;
4337 case 18: sprintf(p, " %s%d", s_dam, 55 + plev); break;
4338 case 19: sprintf(p, " %s%d", s_dam, 80 + plev*3/2); break;
4339 case 20: sprintf(p, " %s%d+d%d", s_dur,10+plev/2, 10+plev/2); break;
4340 case 21: sprintf(p, " %sd%d+d%d", s_dam, 2 * plev, 2 * plev); break;
4341 case 22: sprintf(p, " %s%d", s_dam, 100 + plev*2); break;
4342 case 24: sprintf(p, " %s25+d25", s_dur); break;
4343 case 25: sprintf(p, " %s20+d20", s_dur); break;
4344 case 26: sprintf(p, " %s%d+%d", s_dam, 25+plev/2, 25+plev/2); break;
4345 case 29: sprintf(p, " %s%d", s_dam, plev*15); break;
4346 case 30: sprintf(p, " %s600", s_dam); break;
4347 case 31: sprintf(p, " %s15+d15", s_dur); break;
4351 case 15: /* Music */
4354 case 2 : sprintf(p, " %s%dd4", s_dam, 4 + ((plev - 1) / 5)); break;
4355 case 4 : sprintf(p, " %s2d6", s_heal); break;
4356 case 9 : sprintf(p, " %sd%d", s_dam, plev * 3 / 2); break;
4357 case 13: sprintf(p, " %s%dd7", s_dam, 10 + (plev / 5)); break;
4358 case 20: sprintf(p, " %sd%d+d%d", s_dam, plev * 3, plev * 3); break;
4359 case 22: sprintf(p, " %s%dd10", s_dam, 15 + ((plev - 1) / 2)); break;
4360 case 27: sprintf(p, " %sd%d", s_dam, plev * 3); break;
4361 case 28: sprintf(p, " %s15d10", s_heal); break;
4362 case 30: sprintf(p, " %s%dd10", s_dam, 50 + plev); break;
4367 sprintf(p, "̤ÃΤΥ¿¥¤¥×: %d", realm);
4369 sprintf(p, "Unknown type: %d.", realm);
4376 * Print a list of spells (for browsing or casting or viewing)
4378 void print_spells(int target_spell, byte *spells, int num, int y, int x, int realm)
4380 int i, spell, shougou, increment = 64;
4392 if (((realm < 0) || (realm > MAX_REALM - 1)) && wizard)
4394 msg_print("·Ù¹ð¡ª print_spell ¤¬Îΰè¤Ê¤·¤Ë¸Æ¤Ð¤ì¤¿");
4396 msg_print("Warning! print_spells called with null realm");
4400 /* Title the list */
4402 if (realm+1 == REALM_HISSATSU)
4404 strcpy(buf," Lv MP");
4406 strcpy(buf," Lv SP");
4410 strcpy(buf,"½ÏÎýÅÙ Lv MP ¼ºÎ¨ ¸ú²Ì");
4412 strcpy(buf,"Profic Lv SP Fail Effect");
4416 put_str("̾Á°", y, x + 5);
4417 put_str(buf, y, x + 29);
4419 put_str("Name", y, x + 5);
4420 put_str(buf, y, x + 29);
4423 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE)) increment = 0;
4424 else if ((realm + 1) == p_ptr->realm1) increment = 0;
4425 else if ((realm + 1) == p_ptr->realm2) increment = 32;
4427 /* Dump the spells */
4428 for (i = 0; i < num; i++)
4430 /* Access the spell */
4433 /* Access the spell */
4434 if (!is_magic(realm+1))
4436 s_ptr = &technic_info[realm - MIN_TECHNIC][spell];
4440 s_ptr = &mp_ptr->info[realm][spell];
4443 if (realm+1 == REALM_HISSATSU)
4444 shouhimana = s_ptr->smana;
4447 if (p_ptr->pclass == CLASS_SORCERER)
4448 shouhimana = s_ptr->smana*2200 + 2399;
4449 else if (p_ptr->pclass == CLASS_RED_MAGE)
4450 shouhimana = s_ptr->smana*2600 + 2399;
4451 else if ((realm+1 == p_ptr->realm1) || (realm+1 == p_ptr->realm2))
4452 shouhimana = (s_ptr->smana*(3800-spell_exp[(spell+increment)])+2399);
4454 shouhimana = s_ptr->smana*3800+2399;
4457 else shouhimana *= 4;
4459 if(shouhimana < 1) shouhimana = 1;
4462 if ((increment == 64) || (s_ptr->slevel >= 99)) shougou = 0;
4463 else if (spell_exp[spell+increment]<900) shougou = 0;
4464 else if (spell_exp[spell+increment]<1200) shougou = 1;
4465 else if (spell_exp[spell+increment]<1400) shougou = 2;
4466 else if (spell_exp[spell+increment]<1600) shougou = 3;
4469 if (!increment && (shougou == 4)) max = TRUE;
4470 else if ((increment == 32) && (shougou == 3)) max = TRUE;
4471 else if (s_ptr->slevel >= 99) max = TRUE;
4472 else if (p_ptr->pclass == CLASS_RED_MAGE) max = TRUE;
4474 strncpy(ryakuji,shougou_moji[shougou],4);
4478 if (use_menu && target_spell)
4480 if (i == (target_spell-1))
4482 strcpy(out_val, " ¡Õ ");
4484 strcpy(out_val, " > ");
4487 strcpy(out_val, " ");
4489 else sprintf(out_val, " %c) ", I2A(i));
4490 /* Skip illegible spells */
4491 if (s_ptr->slevel >= 99)
4494 strcat(out_val, format("%-30s", "(ȽÆÉÉÔǽ)"));
4496 strcat(out_val, format("%-30s", "(illegible)"));
4499 c_prt(TERM_L_DARK, out_val, y + i + 1, x);
4503 /* XXX XXX Could label spells above the players level */
4505 /* Get extra info */
4506 spell_info(info, spell, realm);
4511 /* Assume spell is known and tried */
4512 line_attr = TERM_WHITE;
4514 /* Analyze the spell */
4515 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4517 if (s_ptr->slevel > p_ptr->max_plv)
4522 comment = " unknown";
4525 line_attr = TERM_L_BLUE;
4527 else if (s_ptr->slevel > p_ptr->lev)
4532 comment = " forgotten";
4535 line_attr = TERM_YELLOW;
4538 else if ((realm+1 != p_ptr->realm1) && (realm+1 != p_ptr->realm2))
4543 comment = " unknown";
4546 line_attr = TERM_L_BLUE;
4548 else if ((realm + 1 == p_ptr->realm1) ?
4549 ((spell_forgotten1 & (1L << spell))) :
4550 ((spell_forgotten2 & (1L << spell))))
4555 comment = " forgotten";
4558 line_attr = TERM_YELLOW;
4560 else if (!((realm + 1 == p_ptr->realm1) ?
4561 (spell_learned1 & (1L << spell)) :
4562 (spell_learned2 & (1L << spell))))
4567 comment = " unknown";
4570 line_attr = TERM_L_BLUE;
4572 else if (!((realm + 1 == p_ptr->realm1) ?
4573 (spell_worked1 & (1L << spell)) :
4574 (spell_worked2 & (1L << spell))))
4577 comment = " ̤·Ð¸³";
4579 comment = " untried";
4582 line_attr = TERM_L_GREEN;
4585 /* Dump the spell --(-- */
4586 if (realm+1 == REALM_HISSATSU)
4588 strcat(out_val, format("%-25s %2d %4d",
4589 spell_names[technic2magic(realm+1)-1][spell], /* realm, spell */
4590 s_ptr->slevel, shouhimana));
4594 strcat(out_val, format("%-25s%c%-4s %2d %4d %3d%%%s",
4595 spell_names[technic2magic(realm+1)-1][spell], /* realm, spell */
4596 (max ? '!' : ' '), ryakuji,
4597 s_ptr->slevel, shouhimana, spell_chance(spell, realm), comment));
4599 c_prt(line_attr, out_val, y + i + 1, x);
4602 /* Clear the bottom line */
4603 prt("", y + i + 1, x);
4608 * Note that amulets, rods, and high-level spell books are immune
4609 * to "inventory damage" of any kind. Also sling ammo and shovels.
4614 * Does a given class of objects (usually) hate acid?
4615 * Note that acid can either melt or corrode something.
4617 bool hates_acid(object_type *o_ptr)
4619 /* Analyze the type */
4620 switch (o_ptr->tval)
4622 /* Wearable items */
4642 /* Staffs/Scrolls are wood/paper */
4655 /* Junk is useless */
4669 * Does a given object (usually) hate electricity?
4671 bool hates_elec(object_type *o_ptr)
4673 switch (o_ptr->tval)
4687 * Does a given object (usually) hate fire?
4688 * Hafted/Polearm weapons have wooden shafts.
4689 * Arrows/Bows are mostly wooden.
4691 bool hates_fire(object_type *o_ptr)
4693 /* Analyze the type */
4694 switch (o_ptr->tval)
4712 case TV_SORCERY_BOOK:
4713 case TV_NATURE_BOOK:
4717 case TV_ARCANE_BOOK:
4718 case TV_ENCHANT_BOOK:
4719 case TV_DAEMON_BOOK:
4721 case TV_HISSATSU_BOOK:
4732 /* Staffs/Scrolls burn */
4745 * Does a given object (usually) hate cold?
4747 bool hates_cold(object_type *o_ptr)
4749 switch (o_ptr->tval)
4766 int set_acid_destroy(object_type *o_ptr)
4769 if (!hates_acid(o_ptr)) return (FALSE);
4770 object_flags(o_ptr, &f1, &f2, &f3);
4771 if (f3 & TR3_IGNORE_ACID) return (FALSE);
4779 int set_elec_destroy(object_type *o_ptr)
4782 if (!hates_elec(o_ptr)) return (FALSE);
4783 object_flags(o_ptr, &f1, &f2, &f3);
4784 if (f3 & TR3_IGNORE_ELEC) return (FALSE);
4792 int set_fire_destroy(object_type *o_ptr)
4795 if (!hates_fire(o_ptr)) return (FALSE);
4796 object_flags(o_ptr, &f1, &f2, &f3);
4797 if (f3 & TR3_IGNORE_FIRE) return (FALSE);
4805 int set_cold_destroy(object_type *o_ptr)
4808 if (!hates_cold(o_ptr)) return (FALSE);
4809 object_flags(o_ptr, &f1, &f2, &f3);
4810 if (f3 & TR3_IGNORE_COLD) return (FALSE);
4816 * Destroys a type of item on a given percent chance
4817 * Note that missiles are no longer necessarily all destroyed
4818 * Destruction taken from "melee.c" code for "stealing".
4819 * New-style wands and rods handled correctly. -LM-
4820 * Returns number of items destroyed.
4822 int inven_damage(inven_func typ, int perc)
4826 char o_name[MAX_NLEN];
4828 /* Multishadow effects is determined by turn */
4829 if( p_ptr->multishadow && (turn & 1) )return 0;
4831 if (p_ptr->inside_arena) return 0;
4833 /* Count the casualties */
4836 /* Scan through the slots backwards */
4837 for (i = 0; i < INVEN_PACK; i++)
4839 o_ptr = &inventory[i];
4841 /* Skip non-objects */
4842 if (!o_ptr->k_idx) continue;
4844 /* Hack -- for now, skip artifacts */
4845 if (artifact_p(o_ptr) || o_ptr->art_name) continue;
4847 /* Give this item slot a shot at death */
4850 /* Count the casualties */
4851 for (amt = j = 0; j < o_ptr->number; ++j)
4853 if (randint0(100) < perc) amt++;
4856 /* Some casualities */
4859 /* Get a description */
4860 object_desc(o_name, o_ptr, FALSE, 3);
4864 msg_format("%s(%c)¤¬%s²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª",
4866 msg_format("%sour %s (%c) %s destroyed!",
4870 o_name, index_to_label(i),
4871 ((o_ptr->number > 1) ?
4872 ((amt == o_ptr->number) ? "Á´Éô" :
4873 (amt > 1 ? "²¿¸Ä¤«" : "°ì¸Ä")) : "") );
4875 ((o_ptr->number > 1) ?
4876 ((amt == o_ptr->number) ? "All of y" :
4877 (amt > 1 ? "Some of y" : "One of y")) : "Y"),
4878 o_name, index_to_label(i),
4879 ((amt > 1) ? "were" : "was"));
4883 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
4884 msg_print("¤ä¤ê¤ä¤¬¤Ã¤¿¤Ê¡ª");
4887 /* Potions smash open */
4888 if (object_is_potion(o_ptr))
4890 (void)potion_smash_effect(0, py, px, o_ptr->k_idx);
4893 /* Reduce the charges of rods/wands */
4894 reduce_charges(o_ptr, amt);
4896 /* Destroy "amt" items */
4897 inven_item_increase(i, -amt);
4898 inven_item_optimize(i);
4900 /* Count the casualties */
4906 /* Return the casualty count */
4912 * Acid has hit the player, attempt to affect some armor.
4914 * Note that the "base armor" of an object never changes.
4916 * If any armor is damaged (or resists), the player takes less damage.
4918 static int minus_ac(void)
4920 object_type *o_ptr = NULL;
4922 char o_name[MAX_NLEN];
4925 /* Pick a (possibly empty) inventory slot */
4926 switch (randint1(7))
4928 case 1: o_ptr = &inventory[INVEN_RARM]; break;
4929 case 2: o_ptr = &inventory[INVEN_LARM]; break;
4930 case 3: o_ptr = &inventory[INVEN_BODY]; break;
4931 case 4: o_ptr = &inventory[INVEN_OUTER]; break;
4932 case 5: o_ptr = &inventory[INVEN_HANDS]; break;
4933 case 6: o_ptr = &inventory[INVEN_HEAD]; break;
4934 case 7: o_ptr = &inventory[INVEN_FEET]; break;
4937 /* Nothing to damage */
4938 if (!o_ptr->k_idx) return (FALSE);
4940 if (o_ptr->tval < TV_BOOTS) return (FALSE);
4942 /* No damage left to be done */
4943 if (o_ptr->ac + o_ptr->to_a <= 0) return (FALSE);
4947 object_desc(o_name, o_ptr, FALSE, 0);
4949 /* Extract the flags */
4950 object_flags(o_ptr, &f1, &f2, &f3);
4952 /* Object resists */
4953 if (f3 & TR3_IGNORE_ACID)
4956 msg_format("¤·¤«¤·%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª", o_name);
4958 msg_format("Your %s is unaffected!", o_name);
4967 msg_format("%s¤¬¥À¥á¡¼¥¸¤ò¼õ¤±¤¿¡ª", o_name);
4969 msg_format("Your %s is damaged!", o_name);
4973 /* Damage the item */
4976 /* Calculate bonuses */
4977 p_ptr->update |= (PU_BONUS);
4980 p_ptr->window |= (PW_EQUIP | PW_PLAYER);
4984 /* Item was damaged */
4990 * Hurt the player with Acid
4992 void acid_dam(int dam, cptr kb_str, int monspell)
4994 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
4995 bool double_resist = (p_ptr->oppose_acid || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
4997 /* Total Immunity */
4998 if (p_ptr->immune_acid || (dam <= 0))
5000 learn_spell(monspell);
5004 /* Vulnerability (Ouch!) */
5005 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
5006 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
5008 /* Resist the damage */
5009 if (p_ptr->resist_acid) dam = (dam + 2) / 3;
5010 if (double_resist) dam = (dam + 2) / 3;
5012 if ((!(double_resist || p_ptr->resist_acid)) &&
5013 one_in_(HURT_CHANCE))
5014 (void)do_dec_stat(A_CHR);
5016 /* If any armor gets hit, defend the player */
5017 if (minus_ac()) dam = (dam + 1) / 2;
5020 take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
5022 /* Inventory damage */
5023 if (!(double_resist && p_ptr->resist_acid))
5024 inven_damage(set_acid_destroy, inv);
5029 * Hurt the player with electricity
5031 void elec_dam(int dam, cptr kb_str, int monspell)
5033 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
5034 bool double_resist = (p_ptr->oppose_elec || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
5036 /* Total immunity */
5037 if (p_ptr->immune_elec || (dam <= 0))
5039 learn_spell(monspell);
5043 /* Vulnerability (Ouch!) */
5044 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
5045 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
5046 if (p_ptr->prace == RACE_ANDROID) dam += dam / 3;
5048 /* Resist the damage */
5049 if (p_ptr->resist_elec) dam = (dam + 2) / 3;
5050 if (double_resist) dam = (dam + 2) / 3;
5052 if ((!(double_resist || p_ptr->resist_elec)) &&
5053 one_in_(HURT_CHANCE))
5054 (void)do_dec_stat(A_DEX);
5057 take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
5059 /* Inventory damage */
5060 if (!(double_resist && p_ptr->resist_elec))
5061 inven_damage(set_elec_destroy, inv);
5066 * Hurt the player with Fire
5068 void fire_dam(int dam, cptr kb_str, int monspell)
5070 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
5071 bool double_resist = (p_ptr->oppose_fire || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
5073 /* Totally immune */
5074 if (p_ptr->immune_fire || (dam <= 0))
5076 learn_spell(monspell);
5080 /* Vulnerability (Ouch!) */
5081 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
5082 if (prace_is_(RACE_ENT)) dam += dam / 3;
5083 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
5085 /* Resist the damage */
5086 if (p_ptr->resist_fire) dam = (dam + 2) / 3;
5087 if (double_resist) dam = (dam + 2) / 3;
5089 if ((!(double_resist || p_ptr->resist_fire)) &&
5090 one_in_(HURT_CHANCE))
5091 (void)do_dec_stat(A_STR);
5094 take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
5096 /* Inventory damage */
5097 if (!(double_resist && p_ptr->resist_fire))
5098 inven_damage(set_fire_destroy, inv);
5103 * Hurt the player with Cold
5105 void cold_dam(int dam, cptr kb_str, int monspell)
5107 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
5108 bool double_resist = (p_ptr->oppose_cold || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
5110 /* Total immunity */
5111 if (p_ptr->immune_cold || (dam <= 0))
5113 learn_spell(monspell);
5117 /* Vulnerability (Ouch!) */
5118 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
5119 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
5121 /* Resist the damage */
5122 if (p_ptr->resist_cold) dam = (dam + 2) / 3;
5123 if (double_resist) dam = (dam + 2) / 3;
5125 if ((!(double_resist || p_ptr->resist_cold)) &&
5126 one_in_(HURT_CHANCE))
5127 (void)do_dec_stat(A_STR);
5130 take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
5132 /* Inventory damage */
5133 if (!(double_resist && p_ptr->resist_cold))
5134 inven_damage(set_cold_destroy, inv);
5138 bool rustproof(void)
5142 char o_name[MAX_NLEN];
5145 item_tester_no_ryoute = TRUE;
5146 /* Select a piece of armour */
5147 item_tester_hook = item_tester_hook_armour;
5151 q = "¤É¤ÎËɶñ¤Ë»¬»ß¤á¤ò¤·¤Þ¤¹¤«¡©";
5152 s = "»¬»ß¤á¤Ç¤¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
5154 q = "Rustproof which piece of armour? ";
5155 s = "You have nothing to rustproof.";
5158 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return FALSE;
5160 /* Get the item (in the pack) */
5163 o_ptr = &inventory[item];
5166 /* Get the item (on the floor) */
5169 o_ptr = &o_list[0 - item];
5174 object_desc(o_name, o_ptr, FALSE, 0);
5176 o_ptr->art_flags3 |= TR3_IGNORE_ACID;
5178 if ((o_ptr->to_a < 0) && !cursed_p(o_ptr))
5181 msg_format("%s¤Ï¿·ÉÊƱÍͤˤʤä¿¡ª",o_name);
5183 msg_format("%s %s look%s as good as new!",
5184 ((item >= 0) ? "Your" : "The"), o_name,
5185 ((o_ptr->number > 1) ? "" : "s"));
5192 msg_format("%s¤ÏÉå¿©¤·¤Ê¤¯¤Ê¤Ã¤¿¡£", o_name);
5194 msg_format("%s %s %s now protected against corrosion.",
5195 ((item >= 0) ? "Your" : "The"), o_name,
5196 ((o_ptr->number > 1) ? "are" : "is"));
5207 * Curse the players armor
5209 bool curse_armor(void)
5213 char o_name[MAX_NLEN];
5216 /* Curse the body armor */
5217 o_ptr = &inventory[INVEN_BODY];
5219 /* Nothing to curse */
5220 if (!o_ptr->k_idx) return (FALSE);
5224 object_desc(o_name, o_ptr, FALSE, 3);
5226 /* Attempt a saving throw for artifacts */
5227 if ((o_ptr->art_name || artifact_p(o_ptr)) && (randint0(100) < 50))
5231 msg_format("%s¤¬%s¤òÊñ¤ß¹þ¤â¤¦¤È¤·¤¿¤¬¡¢%s¤Ï¤½¤ì¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
5232 "¶²ÉݤΰŹõ¥ª¡¼¥é", "Ëɶñ", o_name);
5234 msg_format("A %s tries to %s, but your %s resists the effects!",
5235 "terrible black aura", "surround your armor", o_name);
5240 /* not artifact or failed save... */
5245 msg_format("¶²ÉݤΰŹõ¥ª¡¼¥é¤¬¤¢¤Ê¤¿¤Î%s¤òÊñ¤ß¹þ¤ó¤À¡ª", o_name);
5247 msg_format("A terrible black aura blasts your %s!", o_name);
5250 chg_virtue(V_ENCHANT, -5);
5252 /* Blast the armor */
5254 o_ptr->name2 = EGO_BLASTED;
5255 o_ptr->to_a = 0 - randint1(5) - randint1(5);
5261 o_ptr->art_flags1 = 0;
5262 o_ptr->art_flags2 = 0;
5263 o_ptr->art_flags3 = 0;
5266 o_ptr->curse_flags = TRC_CURSED;
5269 o_ptr->ident |= (IDENT_BROKEN);
5271 /* Recalculate bonuses */
5272 p_ptr->update |= (PU_BONUS);
5274 /* Recalculate mana */
5275 p_ptr->update |= (PU_MANA);
5278 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
5286 * Curse the players weapon
5288 bool curse_weapon(bool force, int slot)
5292 char o_name[MAX_NLEN];
5295 /* Curse the weapon */
5296 o_ptr = &inventory[slot];
5298 /* Nothing to curse */
5299 if (!o_ptr->k_idx) return (FALSE);
5303 object_desc(o_name, o_ptr, FALSE, 3);
5305 /* Attempt a saving throw */
5306 if ((artifact_p(o_ptr) || o_ptr->art_name) && (randint0(100) < 50) && !force)
5310 msg_format("%s¤¬%s¤òÊñ¤ß¹þ¤â¤¦¤È¤·¤¿¤¬¡¢%s¤Ï¤½¤ì¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
5311 "¶²ÉݤΰŹõ¥ª¡¼¥é", "Éð´ï", o_name);
5313 msg_format("A %s tries to %s, but your %s resists the effects!",
5314 "terrible black aura", "surround your weapon", o_name);
5319 /* not artifact or failed save... */
5324 if (!force) msg_format("¶²ÉݤΰŹõ¥ª¡¼¥é¤¬¤¢¤Ê¤¿¤Î%s¤òÊñ¤ß¹þ¤ó¤À¡ª", o_name);
5326 if (!force) msg_format("A terrible black aura blasts your %s!", o_name);
5329 chg_virtue(V_ENCHANT, -5);
5331 /* Shatter the weapon */
5333 o_ptr->name2 = EGO_SHATTERED;
5334 o_ptr->to_h = 0 - randint1(5) - randint1(5);
5335 o_ptr->to_d = 0 - randint1(5) - randint1(5);
5340 o_ptr->art_flags1 = 0;
5341 o_ptr->art_flags2 = 0;
5342 o_ptr->art_flags3 = 0;
5346 o_ptr->curse_flags = TRC_CURSED;
5349 o_ptr->ident |= (IDENT_BROKEN);
5351 /* Recalculate bonuses */
5352 p_ptr->update |= (PU_BONUS);
5354 /* Recalculate mana */
5355 p_ptr->update |= (PU_MANA);
5358 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
5367 * Enchant some bolts
5369 bool brand_bolts(void)
5373 /* Use the first acceptable bolts */
5374 for (i = 0; i < INVEN_PACK; i++)
5376 object_type *o_ptr = &inventory[i];
5378 /* Skip non-bolts */
5379 if (o_ptr->tval != TV_BOLT) continue;
5381 /* Skip artifacts and ego-items */
5382 if (o_ptr->art_name || artifact_p(o_ptr) || ego_item_p(o_ptr))
5385 /* Skip cursed/broken items */
5386 if (cursed_p(o_ptr) || broken_p(o_ptr)) continue;
5389 if (randint0(100) < 75) continue;
5393 msg_print("¥¯¥í¥¹¥Ü¥¦¤ÎÌ𤬱ê¤Î¥ª¡¼¥é¤ËÊñ¤Þ¤ì¤¿¡ª");
5395 msg_print("Your bolts are covered in a fiery aura!");
5400 o_ptr->name2 = EGO_FLAME;
5403 enchant(o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
5410 if (flush_failure) flush();
5414 msg_print("±ê¤Ç¶¯²½¤¹¤ë¤Î¤Ë¼ºÇÔ¤·¤¿¡£");
5416 msg_print("The fiery enchantment failed.");
5426 * Helper function -- return a "nearby" race for polymorphing
5428 * Note that this function is one of the more "dangerous" ones...
5430 static s16b poly_r_idx(int r_idx)
5432 monster_race *r_ptr = &r_info[r_idx];
5434 int i, r, lev1, lev2;
5436 /* Hack -- Uniques/Questors never polymorph */
5437 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5438 (r_ptr->flags1 & RF1_QUESTOR))
5441 /* Allowable range of "levels" for resulting monster */
5442 lev1 = r_ptr->level - ((randint1(20) / randint1(9)) + 1);
5443 lev2 = r_ptr->level + ((randint1(20) / randint1(9)) + 1);
5445 /* Pick a (possibly new) non-unique race */
5446 for (i = 0; i < 1000; i++)
5448 /* Pick a new race, using a level calculation */
5449 r = get_mon_num((dun_level + r_ptr->level) / 2 + 5);
5451 /* Handle failure */
5457 /* Ignore unique monsters */
5458 if (r_ptr->flags1 & RF1_UNIQUE) continue;
5460 /* Ignore monsters with incompatible levels */
5461 if ((r_ptr->level < lev1) || (r_ptr->level > lev2)) continue;
5463 /* Use that index */
5475 bool polymorph_monster(int y, int x)
5477 cave_type *c_ptr = &cave[y][x];
5478 monster_type *m_ptr = &m_list[c_ptr->m_idx];
5480 bool polymorphed = FALSE;
5482 int old_r_idx = m_ptr->r_idx;
5484 if (p_ptr->inside_arena || p_ptr->inside_battle) return (FALSE);
5486 if ((p_ptr->riding == c_ptr->m_idx) || (m_ptr->mflag2 & MFLAG_KAGE)) return (FALSE);
5488 /* Get the monsters attitude */
5489 friendly = is_friendly(m_ptr);
5490 pet = is_pet(m_ptr);
5492 /* Pick a "new" monster race */
5493 new_r_idx = poly_r_idx(old_r_idx);
5495 /* Handle polymorph */
5496 if (new_r_idx != old_r_idx)
5498 /* "Kill" the "old" monster */
5499 delete_monster_idx(c_ptr->m_idx);
5501 /* Create a new monster (no groups) */
5502 if (place_monster_aux(y, x, new_r_idx, FALSE, FALSE, friendly, pet, FALSE, (bool)(m_ptr->mflag2 & MFLAG_NOPET)))
5509 monster_terrain_sensitive = FALSE;
5511 /* Placing the new monster failed */
5512 place_monster_aux(y, x, old_r_idx, FALSE, FALSE, friendly, pet, TRUE, (bool)(m_ptr->mflag2 & MFLAG_NOPET));
5514 monster_terrain_sensitive = TRUE;
5525 bool dimension_door(void)
5527 int plev = p_ptr->lev;
5530 if (!tgt_pt(&x, &y)) return FALSE;
5532 p_ptr->energy -= 60 - plev;
5534 if (!cave_empty_bold(y, x) || (cave[y][x].info & CAVE_ICKY) ||
5535 (distance(y, x, py, px) > plev / 2 + 10) ||
5536 (!randint0(plev / 10 + 10)))
5538 if( p_ptr->pclass != CLASS_MIRROR_MASTER ){
5540 msg_print("ÀºÎ¤«¤éʪ¼Á³¦¤ËÌá¤ë»þ¤¦¤Þ¤¯¤¤¤«¤Ê¤«¤Ã¤¿¡ª");
5542 msg_print("You fail to exit the astral plane correctly!");
5547 msg_print("¶À¤ÎÀ¤³¦¤ò¤¦¤Þ¤¯Ä̤ì¤Ê¤«¤Ã¤¿¡ª");
5549 msg_print("You fail to exit the astral plane correctly!");
5552 p_ptr->energy -= 60 - plev;
5553 teleport_player((plev+2)*2);
5555 else teleport_player_to(y, x, TRUE);
5561 bool eat_magic(int power)
5563 object_type * o_ptr;
5566 int recharge_strength = 0;
5572 char o_name[MAX_NLEN];
5574 item_tester_hook = item_tester_hook_recharge;
5578 q = "¤É¤Î¥¢¥¤¥Æ¥à¤«¤éËâÎϤòµÛ¼ý¤·¤Þ¤¹¤«¡©";
5579 s = "ËâÎϤòµÛ¼ý¤Ç¤¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£";
5581 q = "Drain which item? ";
5582 s = "You have nothing to drain.";
5585 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return FALSE;
5589 o_ptr = &inventory[item];
5593 o_ptr = &o_list[0 - item];
5596 k_ptr = &k_info[o_ptr->k_idx];
5597 lev = get_object_level(o_ptr);
5599 if (o_ptr->tval == TV_ROD)
5601 recharge_strength = ((power > lev/2) ? (power - lev/2) : 0) / 5;
5604 if (one_in_(recharge_strength))
5606 /* Activate the failure code. */
5611 if (o_ptr->timeout > (o_ptr->number - 1) * k_ptr->pval)
5614 msg_print("½¼Å¶Ãæ¤Î¥í¥Ã¥É¤«¤éËâÎϤòµÛ¼ý¤¹¤ë¤³¤È¤Ï¤Ç¤¤Þ¤»¤ó¡£");
5616 msg_print("You can't absorb energy from a discharged rod.");
5623 o_ptr->timeout += k_ptr->pval;
5629 /* All staffs, wands. */
5630 recharge_strength = (100 + power - lev) / 15;
5633 if (recharge_strength < 0) recharge_strength = 0;
5636 if (one_in_(recharge_strength))
5638 /* Activate the failure code. */
5643 if (o_ptr->pval > 0)
5645 p_ptr->csp += lev / 2;
5648 /* XXX Hack -- unstack if necessary */
5649 if ((o_ptr->tval == TV_STAFF) && (item >= 0) && (o_ptr->number > 1))
5654 /* Get local object */
5657 /* Obtain a local object */
5658 object_copy(q_ptr, o_ptr);
5660 /* Modify quantity */
5663 /* Restore the charges */
5666 /* Unstack the used item */
5668 p_ptr->total_weight -= q_ptr->weight;
5669 item = inven_carry(q_ptr);
5673 msg_print("¾ó¤ò¤Þ¤È¤á¤Ê¤ª¤·¤¿¡£");
5675 msg_print("You unstack your staff.");
5683 msg_print("µÛ¼ý¤Ç¤¤ëËâÎϤ¬¤¢¤ê¤Þ¤»¤ó¡ª");
5685 msg_print("There's no energy there to absorb!");
5689 if (!o_ptr->pval) o_ptr->ident |= IDENT_EMPTY;
5693 /* Inflict the penalties for failing a recharge. */
5696 /* Artifacts are never destroyed. */
5697 if (artifact_p(o_ptr))
5699 object_desc(o_name, o_ptr, TRUE, 0);
5701 msg_format("ËâÎϤ¬µÕή¤·¤¿¡ª%s¤Ï´°Á´¤ËËâÎϤò¼º¤Ã¤¿¡£", o_name);
5703 msg_format("The recharging backfires - %s is completely drained!", o_name);
5707 /* Artifact rods. */
5708 if (o_ptr->tval == TV_ROD)
5709 o_ptr->timeout = k_ptr->pval * o_ptr->number;
5711 /* Artifact wands and staffs. */
5712 else if ((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_STAFF))
5717 /* Get the object description */
5718 object_desc(o_name, o_ptr, FALSE, 0);
5720 /*** Determine Seriousness of Failure ***/
5722 /* Mages recharge objects more safely. */
5723 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)
5725 /* 10% chance to blow up one rod, otherwise draining. */
5726 if (o_ptr->tval == TV_ROD)
5728 if (one_in_(10)) fail_type = 2;
5731 /* 75% chance to blow up one wand, otherwise draining. */
5732 else if (o_ptr->tval == TV_WAND)
5734 if (!one_in_(3)) fail_type = 2;
5737 /* 50% chance to blow up one staff, otherwise no effect. */
5738 else if (o_ptr->tval == TV_STAFF)
5740 if (one_in_(2)) fail_type = 2;
5745 /* All other classes get no special favors. */
5748 /* 33% chance to blow up one rod, otherwise draining. */
5749 if (o_ptr->tval == TV_ROD)
5751 if (one_in_(3)) fail_type = 2;
5754 /* 20% chance of the entire stack, else destroy one wand. */
5755 else if (o_ptr->tval == TV_WAND)
5757 if (one_in_(5)) fail_type = 3;
5760 /* Blow up one staff. */
5761 else if (o_ptr->tval == TV_STAFF)
5767 /*** Apply draining and destruction. ***/
5769 /* Drain object or stack of objects. */
5772 if (o_ptr->tval == TV_ROD)
5775 msg_print("¥í¥Ã¥É¤ÏÇË»¤òÌȤ줿¤¬¡¢ËâÎϤÏÁ´¤Æ¼º¤Ê¤ï¤ì¤¿¡£");
5777 msg_format("You save your rod from destruction, but all charges are lost.", o_name);
5780 o_ptr->timeout = k_ptr->pval * o_ptr->number;
5782 else if (o_ptr->tval == TV_WAND)
5785 msg_format("%s¤ÏÇË»¤òÌȤ줿¤¬¡¢ËâÎϤ¬Á´¤Æ¼º¤ï¤ì¤¿¡£", o_name);
5787 msg_format("You save your %s from destruction, but all charges are lost.", o_name);
5792 /* Staffs aren't drained. */
5795 /* Destroy an object or one in a stack of objects. */
5798 if (o_ptr->number > 1)
5801 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬°ìËܲõ¤ì¤¿¡ª", o_name);
5803 msg_format("Wild magic consumes one of your %s!", o_name);
5806 /* Reduce rod stack maximum timeout, drain wands. */
5807 if (o_ptr->tval == TV_ROD) o_ptr->timeout -= k_ptr->pval;
5808 if (o_ptr->tval == TV_WAND) o_ptr->pval = o_ptr->pval * (o_ptr->number - 1) / o_ptr->number;
5813 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²¿Ëܤ«²õ¤ì¤¿¡ª", o_name);
5815 msg_format("Wild magic consumes your %s!", o_name);
5818 /* Reduce and describe inventory */
5821 inven_item_increase(item, -1);
5822 inven_item_describe(item);
5823 inven_item_optimize(item);
5826 /* Reduce and describe floor item */
5829 floor_item_increase(0 - item, -1);
5830 floor_item_describe(0 - item);
5831 floor_item_optimize(0 - item);
5835 /* Destroy all members of a stack of objects. */
5838 if (o_ptr->number > 1)
5840 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬Á´¤Æ²õ¤ì¤¿¡ª", o_name);
5842 msg_format("Wild magic consumes all your %s!", o_name);
5847 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²õ¤ì¤¿¡ª", o_name);
5849 msg_format("Wild magic consumes your %s!", o_name);
5854 /* Reduce and describe inventory */
5857 inven_item_increase(item, -999);
5858 inven_item_describe(item);
5859 inven_item_optimize(item);
5862 /* Reduce and describe floor item */
5865 floor_item_increase(0 - item, -999);
5866 floor_item_describe(0 - item);
5867 floor_item_optimize(0 - item);
5873 if (p_ptr->csp > p_ptr->msp)
5875 p_ptr->csp = p_ptr->msp;
5878 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
5879 p_ptr->window |= (PW_INVEN);
5885 bool summon_kin_player(bool pet, int level, int y, int x, bool group)
5887 switch (p_ptr->mimic_form)
5890 switch (p_ptr->prace)
5894 case RACE_BARBARIAN:
5897 summon_kin_type = 'p';
5907 case RACE_MIND_FLAYER:
5910 summon_kin_type = 'h';
5913 summon_kin_type = 'o';
5915 case RACE_HALF_TROLL:
5916 summon_kin_type = 'T';
5918 case RACE_HALF_OGRE:
5919 summon_kin_type = 'O';
5921 case RACE_HALF_GIANT:
5922 case RACE_HALF_TITAN:
5924 summon_kin_type = 'P';
5927 summon_kin_type = 'y';
5930 summon_kin_type = 'K';
5933 summon_kin_type = 'k';
5936 if (one_in_(13)) summon_kin_type = 'U';
5937 else summon_kin_type = 'u';
5939 case RACE_DRACONIAN:
5940 summon_kin_type = 'd';
5944 summon_kin_type = 'g';
5947 if (one_in_(13)) summon_kin_type = 'L';
5948 else summon_kin_type = 's';
5951 summon_kin_type = 'z';
5954 summon_kin_type = 'V';
5957 summon_kin_type = 'G';
5960 summon_kin_type = 'I';
5963 summon_kin_type = '#';
5966 summon_kin_type = 'A';
5969 summon_kin_type = 'U';
5972 summon_kin_type = 'p';
5977 if (one_in_(13)) summon_kin_type = 'U';
5978 else summon_kin_type = 'u';
5980 case MIMIC_DEMON_LORD:
5981 summon_kin_type = 'U';
5984 summon_kin_type = 'V';
5987 return summon_specific((pet ? -1 : 0), y, x, level, SUMMON_KIN, group, FALSE, pet, FALSE, (bool)(!pet));