4 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
6 * This software may be copied and distributed for educational, research,
7 * and not for profit purposes provided that this copyright and statement
8 * are included in all such copies. Other copyrights may also apply.
11 /* Purpose: Spell code (part 3) */
15 /* Maximum number of tries for teleporting */
18 /* 1/x chance of reducing stats (for elemental attacks) */
19 #define HURT_CHANCE 16
22 static bool cave_monster_teleportable_bold(int m_idx, int y, int x, bool passive)
24 monster_type *m_ptr = &m_list[m_idx];
25 cave_type *c_ptr = &cave[y][x];
26 feature_type *f_ptr = &f_info[c_ptr->feat];
28 /* Require "teleportable" space */
29 if (!have_flag(f_ptr->flags, FF_TELEPORTABLE)) return FALSE;
31 if (c_ptr->m_idx && (c_ptr->m_idx != m_idx)) return FALSE;
32 if (player_bold(y, x)) return FALSE;
34 /* Hack -- no teleport onto glyph of warding */
35 if (is_glyph_grid(c_ptr)) return FALSE;
36 if (is_explosive_rune_grid(c_ptr)) return FALSE;
40 if (!monster_can_cross_terrain(c_ptr->feat, &r_info[m_ptr->r_idx], 0)) return FALSE;
48 * Teleport a monster, normally up to "dis" grids away.
50 * Attempt to move the monster at least "dis/2" grids away.
52 * But allow variation to prevent infinite loops.
54 bool teleport_away(int m_idx, int dis, bool dec_valour, bool passive)
56 int oy, ox, d, i, min;
62 monster_type *m_ptr = &m_list[m_idx];
65 if (!m_ptr->r_idx) return (FALSE);
67 /* Save the old location */
71 /* Minimum distance */
75 (((p_ptr->chp * 10) / p_ptr->mhp) > 5) &&
76 (4+randint1(5) < ((p_ptr->chp * 10) / p_ptr->mhp)))
78 chg_virtue(V_VALOUR, -1);
86 /* Verify max distance */
87 if (dis > 200) dis = 200;
89 /* Try several locations */
90 for (i = 0; i < 500; i++)
92 /* Pick a (possibly illegal) location */
95 ny = rand_spread(oy, dis);
96 nx = rand_spread(ox, dis);
97 d = distance(oy, ox, ny, nx);
98 if ((d >= min) && (d <= dis)) break;
101 /* Ignore illegal locations */
102 if (!in_bounds(ny, nx)) continue;
104 if (!cave_monster_teleportable_bold(m_idx, ny, nx, passive)) continue;
106 /* No teleporting into vaults and such */
107 if (!(p_ptr->inside_quest || p_ptr->inside_arena))
108 if (cave[ny][nx].info & CAVE_ICKY) continue;
110 /* This grid looks good */
117 /* Increase the maximum distance */
120 /* Decrease the minimum distance */
123 /* Stop after MAX_TRIES tries */
124 if (tries > MAX_TRIES) return (FALSE);
128 sound(SOUND_TPOTHER);
130 /* Update the new location */
131 cave[ny][nx].m_idx = m_idx;
133 /* Update the old location */
134 cave[oy][ox].m_idx = 0;
136 /* Move the monster */
140 /* Forget the counter target */
143 /* Update the monster (new location) */
144 update_mon(m_idx, TRUE);
146 /* Redraw the old grid */
149 /* Redraw the new grid */
152 if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
153 p_ptr->update |= (PU_MON_LITE);
161 * Teleport monster next to a grid near the given location
163 void teleport_monster_to(int m_idx, int ty, int tx, int power, bool passive)
165 int ny, nx, oy, ox, d, i, min;
169 monster_type *m_ptr = &m_list[m_idx];
172 if (!m_ptr->r_idx) return;
175 if (randint1(100) > power) return;
181 /* Save the old location */
185 /* Minimum distance */
188 /* Look until done */
189 while (look && --attempts)
191 /* Verify max distance */
192 if (dis > 200) dis = 200;
194 /* Try several locations */
195 for (i = 0; i < 500; i++)
197 /* Pick a (possibly illegal) location */
200 ny = rand_spread(ty, dis);
201 nx = rand_spread(tx, dis);
202 d = distance(ty, tx, ny, nx);
203 if ((d >= min) && (d <= dis)) break;
206 /* Ignore illegal locations */
207 if (!in_bounds(ny, nx)) continue;
209 if (!cave_monster_teleportable_bold(m_idx, ny, nx, passive)) continue;
211 /* No teleporting into vaults and such */
212 /* if (cave[ny][nx].info & (CAVE_ICKY)) continue; */
214 /* This grid looks good */
221 /* Increase the maximum distance */
224 /* Decrease the minimum distance */
228 if (attempts < 1) return;
231 sound(SOUND_TPOTHER);
233 /* Update the new location */
234 cave[ny][nx].m_idx = m_idx;
236 /* Update the old location */
237 cave[oy][ox].m_idx = 0;
239 /* Move the monster */
243 /* Update the monster (new location) */
244 update_mon(m_idx, TRUE);
246 /* Redraw the old grid */
249 /* Redraw the new grid */
252 if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
253 p_ptr->update |= (PU_MON_LITE);
257 bool cave_player_teleportable_bold(int y, int x, bool passive, bool nonmagical)
259 cave_type *c_ptr = &cave[y][x];
260 feature_type *f_ptr = &f_info[c_ptr->feat];
262 /* Require "teleportable" space */
263 if (!have_flag(f_ptr->flags, FF_TELEPORTABLE)) return FALSE;
265 /* No magical teleporting into vaults and such */
266 if (!nonmagical && (c_ptr->info & CAVE_ICKY)) return FALSE;
268 if (c_ptr->m_idx && (c_ptr->m_idx != p_ptr->riding)) return FALSE;
272 if (!player_can_enter(c_ptr->feat, 0)) return FALSE;
274 if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP))
276 if (!p_ptr->levitation && !p_ptr->can_swim) return FALSE;
279 if (have_flag(f_ptr->flags, FF_LAVA) && !p_ptr->immune_fire && !IS_INVULN())
281 /* Always forbid deep lava */
282 if (have_flag(f_ptr->flags, FF_DEEP)) return FALSE;
284 /* Forbid shallow lava when the player don't have levitation */
285 if (!p_ptr->levitation) return FALSE;
288 if (have_flag(f_ptr->flags, FF_HIT_TRAP))
290 if (!is_known_trap(c_ptr) || !trap_can_be_ignored(c_ptr->feat)) return FALSE;
299 * Teleport the player to a location up to "dis" grids away.
301 * If no such spaces are readily available, the distance may increase.
302 * Try very hard to move the player at least a quarter that distance.
304 * There was a nasty tendency for a long time; which was causing the
305 * player to "bounce" between two or three different spots because
306 * these are the only spots that are "far enough" way to satisfy the
309 * But this tendency is now removed; in the new algorithm, a list of
310 * candidates is selected first, which includes at least 50% of all
311 * floor grids within the distance, and any single grid in this list
312 * of candidates has equal possibility to be choosen as a destination.
315 #define MAX_TELEPORT_DISTANCE 200
317 void teleport_player(int dis, bool passive)
319 int candidates_at[MAX_TELEPORT_DISTANCE + 1];
320 int total_candidates, cur_candidates;
321 int y = 0, x = 0, min, pick, i;
324 int left = MAX(1, px - dis);
325 int right = MIN(cur_wid - 2, px + dis);
326 int top = MAX(1, py - dis);
327 int bottom = MIN(cur_hgt - 2, py + dis);
329 /* Initialize counters */
330 total_candidates = 0;
331 for (i = 0; i <= MAX_TELEPORT_DISTANCE; i++)
332 candidates_at[i] = 0;
334 /* Limit the distance */
335 if (dis > MAX_TELEPORT_DISTANCE) dis = MAX_TELEPORT_DISTANCE;
337 /* Search valid locations */
338 for (y = top; y <= bottom; y++)
340 for (x = left; x <= right; x++)
344 /* Skip illegal locations */
345 if (!cave_player_teleportable_bold(y, x, passive, FALSE)) continue;
347 /* Calculate distance */
348 d = distance(py, px, y, x);
350 /* Skip too far locations */
351 if (d > dis) continue;
353 /* Count the total number of candidates */
356 /* Count the number of candidates in this circumference */
361 /* No valid location! */
362 if (0 == total_candidates) return;
364 /* Fix the minimum distance */
365 for (cur_candidates = 0, min = dis; min >= 0; min--)
367 cur_candidates += candidates_at[min];
369 /* 50% of all candidates will have an equal chance to be choosen. */
370 if (cur_candidates >= total_candidates / 2) break;
373 /* Pick up a single location randomly */
374 pick = randint1(cur_candidates);
376 /* Search again the choosen location */
377 for (y = top; y <= bottom; y++)
379 for (x = left; x <= right; x++)
383 /* Skip illegal locations */
384 if (!cave_player_teleportable_bold(y, x, passive, FALSE)) continue;
386 /* Calculate distance */
387 d = distance(py, px, y, x);
389 /* Skip too far locations */
390 if (d > dis) continue;
392 /* Skip too close locations */
393 if (d < min) continue;
395 /* This grid was picked up? */
405 sound(SOUND_TELEPORT);
408 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
409 msg_format("¡Ø¤³¤Ã¤Á¤À¤¡¡¢%s¡Ù", player_name);
412 /* Save the old location */
416 /* Move the player */
417 (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
419 /* Monsters with teleport ability may follow the player */
420 for (xx = -1; xx < 2; xx++)
422 for (yy = -1; yy < 2; yy++)
424 int tmp_m_idx = cave[oy+yy][ox+xx].m_idx;
426 /* A monster except your mount may follow */
427 if (tmp_m_idx && p_ptr->riding != tmp_m_idx)
429 monster_type *m_ptr = &m_list[tmp_m_idx];
430 monster_race *r_ptr = &r_info[m_ptr->r_idx];
433 * The latter limitation is to avoid
434 * totally unkillable suckers...
436 if ((r_ptr->flags6 & RF6_TPORT) &&
437 !(r_ptr->flagsr & RFR_RES_TELE))
439 if (!m_ptr->csleep) teleport_monster_to(tmp_m_idx, y, x, r_ptr->level, FALSE);
448 * Teleport player to a grid near the given location
450 * This function is slightly obsessive about correctness.
451 * This function allows teleporting into vaults (!)
453 void teleport_player_to(int ny, int nx, bool no_tele, bool passive)
455 int y, x, dis = 0, ctr = 0;
457 if (p_ptr->anti_tele && no_tele)
460 msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
462 msg_print("A mysterious force prevents you from teleporting!");
468 /* Find a usable location */
471 /* Pick a nearby legal location */
474 y = rand_spread(ny, dis);
475 x = rand_spread(nx, dis);
476 if (in_bounds(y, x)) break;
479 /* Accept any grid when wizard mode */
480 if (p_ptr->wizard && (!cave[y][x].m_idx || (cave[y][x].m_idx == p_ptr->riding))) break;
482 /* Accept teleportable floor grids */
483 if (cave_player_teleportable_bold(y, x, passive, !no_tele)) break;
485 /* Occasionally advance the distance */
486 if (++ctr > (4 * dis * dis + 4 * dis + 1))
494 sound(SOUND_TELEPORT);
496 /* Move the player */
497 (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
503 * Teleport the player one level up or down (random when legal)
504 * Note: If m_idx <= 0, target is player.
506 void teleport_level(int m_idx)
512 if (m_idx <= 0) /* To player */
515 strcpy(m_name, "¤¢¤Ê¤¿");
517 strcpy(m_name, "you");
520 else /* To monster */
522 monster_type *m_ptr = &m_list[m_idx];
524 /* Get the monster name (or "it") */
525 monster_desc(m_name, m_ptr, 0);
527 see_m = is_seen(m_ptr);
530 /* No effect in some case */
531 if (TELE_LEVEL_IS_INEFF(m_idx))
534 if (see_m) msg_print("¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£");
536 if (see_m) msg_print("There is no effect.");
542 if ((m_idx <= 0) && p_ptr->anti_tele) /* To player */
545 msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
547 msg_print("A mysterious force prevents you from teleporting!");
552 /* Choose up or down */
553 if (randint0(100) < 50) go_up = TRUE;
556 if ((m_idx <= 0) && p_ptr->wizard)
558 if (get_check("Force to go up? ")) go_up = TRUE;
559 else if (get_check("Force to go down? ")) go_up = FALSE;
563 if ((ironman_downward && (m_idx <= 0)) || (dun_level <= d_info[dungeon_type].mindepth))
566 if (see_m) msg_format("%^s¤Ï¾²¤òÆͤÇˤäÆÄÀ¤ó¤Ç¤¤¤¯¡£", m_name);
568 if (see_m) msg_format("%^s sink%s through the floor.", m_name, (m_idx <= 0) ? "" : "s");
570 if (m_idx <= 0) /* To player */
574 dungeon_type = p_ptr->recall_dungeon;
579 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL);
581 if (autosave_l) do_cmd_save_game(TRUE);
585 dun_level = d_info[dungeon_type].mindepth;
586 prepare_change_floor_mode(CFM_RAND_PLACE);
590 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
594 p_ptr->leaving = TRUE;
599 else if (quest_number(dun_level) || (dun_level >= d_info[dungeon_type].maxdepth))
602 if (see_m) msg_format("%^s¤ÏÅ·°æ¤òÆͤÇˤäÆÃè¤ØÉ⤤¤Æ¤¤¤¯¡£", m_name);
604 if (see_m) msg_format("%^s rise%s up through the ceiling.", m_name, (m_idx <= 0) ? "" : "s");
608 if (m_idx <= 0) /* To player */
610 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, -1, NULL);
612 if (autosave_l) do_cmd_save_game(TRUE);
614 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP | CFM_RAND_PLACE | CFM_RAND_CONNECT);
619 p_ptr->inside_quest = 0;
620 p_ptr->leaving = TRUE;
626 if (see_m) msg_format("%^s¤ÏÅ·°æ¤òÆͤÇˤäÆÃè¤ØÉ⤤¤Æ¤¤¤¯¡£", m_name);
628 if (see_m) msg_format("%^s rise%s up through the ceiling.", m_name, (m_idx <= 0) ? "" : "s");
632 if (m_idx <= 0) /* To player */
634 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, -1, NULL);
636 if (autosave_l) do_cmd_save_game(TRUE);
638 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP | CFM_RAND_PLACE | CFM_RAND_CONNECT);
641 p_ptr->leaving = TRUE;
647 if (see_m) msg_format("%^s¤Ï¾²¤òÆͤÇˤäÆÄÀ¤ó¤Ç¤¤¤¯¡£", m_name);
649 if (see_m) msg_format("%^s sink%s through the floor.", m_name, (m_idx <= 0) ? "" : "s");
652 if (m_idx <= 0) /* To player */
654 /* Never reach this code on the surface */
655 /* if (!dun_level) dungeon_type = p_ptr->recall_dungeon; */
657 if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL);
659 if (autosave_l) do_cmd_save_game(TRUE);
661 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
664 p_ptr->leaving = TRUE;
668 /* Monster level teleportation is simple deleting now */
671 monster_type *m_ptr = &m_list[m_idx];
673 /* Check for quest completion */
674 check_quest_completion(m_ptr);
676 delete_monster_idx(m_idx);
680 sound(SOUND_TPLEVEL);
685 int choose_dungeon(cptr note, int y, int x)
691 /* Hack -- No need to choose dungeon in some case */
692 if (lite_town || vanilla_town || ironman_downward)
694 if (max_dlv[DUNGEON_ANGBAND]) return DUNGEON_ANGBAND;
698 msg_format("¤Þ¤À%s¤ËÆþ¤Ã¤¿¤³¤È¤Ï¤Ê¤¤¡£", d_name + d_info[DUNGEON_ANGBAND].name);
700 msg_format("You haven't entered %s yet.", d_name + d_info[DUNGEON_ANGBAND].name);
707 /* Allocate the "dun" array */
708 C_MAKE(dun, max_d_idx, s16b);
711 for(i = 1; i < max_d_idx; i++)
716 if (!d_info[i].maxdepth) continue;
717 if (!max_dlv[i]) continue;
718 if (d_info[i].final_guardian)
720 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
722 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
725 sprintf(buf," %c) %c%-12s : ºÇÂç %d ³¬", 'a'+num, seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
727 sprintf(buf," %c) %c%-16s : Max level %d", 'a'+num, seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
729 prt(buf, y + num, x);
736 prt(" Áª¤Ù¤ë¥À¥ó¥¸¥ç¥ó¤¬¤Ê¤¤¡£", y, x);
738 prt(" No dungeon is available.", y, x);
743 prt(format("¤É¤Î¥À¥ó¥¸¥ç¥ó%s¤·¤Þ¤¹¤«:", note), 0, 0);
745 prt(format("Which dungeon do you %s?: ", note), 0, 0);
750 if ((i == ESCAPE) || !num)
752 /* Free the "dun" array */
753 C_KILL(dun, max_d_idx, s16b);
758 if (i >= 'a' && i <('a'+num))
760 select_dungeon = dun[i-'a'];
767 /* Free the "dun" array */
768 C_KILL(dun, max_d_idx, s16b);
770 return select_dungeon;
775 * Recall the player to town or dungeon
777 bool recall_player(int turns)
780 * TODO: Recall the player to the last
781 * visited town when in the wilderness
785 if (p_ptr->inside_arena || ironman_downward)
788 msg_print("²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
790 msg_print("Nothing happens.");
796 if (dun_level && (max_dlv[dungeon_type] > dun_level) && !p_ptr->inside_quest && !p_ptr->word_recall)
799 if (get_check("¤³¤³¤ÏºÇ¿¼Åþ㳬¤è¤êÀõ¤¤³¬¤Ç¤¹¡£¤³¤Î³¬¤ËÌá¤Ã¤ÆÍè¤Þ¤¹¤«¡© "))
801 if (get_check("Reset recall depth? "))
804 max_dlv[dungeon_type] = dun_level;
807 do_cmd_write_nikki(NIKKI_TRUMP, dungeon_type, "µ¢´Ô¤Î¤È¤¤Ë");
809 do_cmd_write_nikki(NIKKI_TRUMP, dungeon_type, "when recall from dungeon");
814 if (!p_ptr->word_recall)
820 select_dungeon = choose_dungeon("¤Ëµ¢´Ô", 2, 14);
822 select_dungeon = choose_dungeon("recall", 2, 14);
824 if (!select_dungeon) return FALSE;
825 p_ptr->recall_dungeon = select_dungeon;
827 p_ptr->word_recall = turns;
829 msg_print("²ó¤ê¤ÎÂ絤¤¬Ä¥¤ê¤Ä¤á¤Æ¤¤¿...");
831 msg_print("The air about you becomes charged...");
834 p_ptr->redraw |= (PR_STATUS);
838 p_ptr->word_recall = 0;
840 msg_print("Ä¥¤ê¤Ä¤á¤¿Â絤¤¬Î®¤ìµî¤Ã¤¿...");
842 msg_print("A tension leaves the air around you...");
845 p_ptr->redraw |= (PR_STATUS);
851 bool word_of_recall(void)
853 return(recall_player(randint0(21) + 15));
857 bool reset_recall(void)
859 int select_dungeon, dummy = 0;
864 select_dungeon = choose_dungeon("¤ò¥»¥Ã¥È", 2, 14);
866 select_dungeon = choose_dungeon("reset", 2, 14);
870 if (ironman_downward)
873 msg_print("²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
875 msg_print("Nothing happens.");
881 if (!select_dungeon) return FALSE;
884 sprintf(ppp, "²¿³¬¤Ë¥»¥Ã¥È¤·¤Þ¤¹¤« (%d-%d):", d_info[select_dungeon].mindepth, max_dlv[select_dungeon]);
886 sprintf(ppp, "Reset to which level (%d-%d): ", d_info[select_dungeon].mindepth, max_dlv[select_dungeon]);
891 sprintf(tmp_val, "%d", MAX(dun_level, 1));
893 /* Ask for a level */
894 if (get_string(ppp, tmp_val, 10))
896 /* Extract request */
897 dummy = atoi(tmp_val);
900 if (dummy < 1) dummy = 1;
903 if (dummy > max_dlv[select_dungeon]) dummy = max_dlv[select_dungeon];
904 if (dummy < d_info[select_dungeon].mindepth) dummy = d_info[select_dungeon].mindepth;
906 max_dlv[select_dungeon] = dummy;
910 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "¥Õ¥í¥¢¡¦¥ê¥»¥Ã¥È¤Ç");
912 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "using a scroll of reset recall");
916 msg_format("%s¤Îµ¢´Ô¥ì¥Ù¥ë¤ò %d ³¬¤Ë¥»¥Ã¥È¡£", d_name+d_info[select_dungeon].name, dummy, dummy * 50);
918 msg_format("Recall depth set to level %d (%d').", dummy, dummy * 50);
931 * Apply disenchantment to the player's stuff
933 * XXX XXX XXX This function is also called from the "melee" code
935 * Return "TRUE" if the player notices anything
937 bool apply_disenchant(int mode)
941 char o_name[MAX_NLEN];
942 int to_h, to_d, to_a, pval;
944 /* Pick a random slot */
947 case 1: t = INVEN_RARM; break;
948 case 2: t = INVEN_LARM; break;
949 case 3: t = INVEN_BOW; break;
950 case 4: t = INVEN_BODY; break;
951 case 5: t = INVEN_OUTER; break;
952 case 6: t = INVEN_HEAD; break;
953 case 7: t = INVEN_HANDS; break;
954 case 8: t = INVEN_FEET; break;
958 o_ptr = &inventory[t];
960 /* No item, nothing happens */
961 if (!o_ptr->k_idx) return (FALSE);
963 /* Disenchant equipments only -- No disenchant on monster ball */
964 if (!object_is_weapon_armour_ammo(o_ptr))
967 /* Nothing to disenchant */
968 if ((o_ptr->to_h <= 0) && (o_ptr->to_d <= 0) && (o_ptr->to_a <= 0) && (o_ptr->pval <= 1))
970 /* Nothing to notice */
975 /* Describe the object */
976 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
979 /* Artifacts have 71% chance to resist */
980 if (object_is_artifact(o_ptr) && (randint0(100) < 71))
984 msg_format("%s(%c)¤ÏÎô²½¤òÄ·¤ÍÊÖ¤·¤¿¡ª",o_name, index_to_label(t) );
986 msg_format("Your %s (%c) resist%s disenchantment!",
987 o_name, index_to_label(t),
988 ((o_ptr->number != 1) ? "" : "s"));
997 /* Memorize old value */
1003 /* Disenchant tohit */
1004 if (o_ptr->to_h > 0) o_ptr->to_h--;
1005 if ((o_ptr->to_h > 5) && (randint0(100) < 20)) o_ptr->to_h--;
1007 /* Disenchant todam */
1008 if (o_ptr->to_d > 0) o_ptr->to_d--;
1009 if ((o_ptr->to_d > 5) && (randint0(100) < 20)) o_ptr->to_d--;
1011 /* Disenchant toac */
1012 if (o_ptr->to_a > 0) o_ptr->to_a--;
1013 if ((o_ptr->to_a > 5) && (randint0(100) < 20)) o_ptr->to_a--;
1015 /* Disenchant pval (occasionally) */
1016 /* Unless called from wild_magic() */
1017 if ((o_ptr->pval > 1) && one_in_(13) && !(mode & 0x01)) o_ptr->pval--;
1019 if ((to_h != o_ptr->to_h) || (to_d != o_ptr->to_d) ||
1020 (to_a != o_ptr->to_a) || (pval != o_ptr->pval))
1024 msg_format("%s(%c)¤ÏÎô²½¤·¤Æ¤·¤Þ¤Ã¤¿¡ª",
1025 o_name, index_to_label(t) );
1027 msg_format("Your %s (%c) %s disenchanted!",
1028 o_name, index_to_label(t),
1029 ((o_ptr->number != 1) ? "were" : "was"));
1032 chg_virtue(V_HARMONY, 1);
1033 chg_virtue(V_ENCHANT, -2);
1035 /* Recalculate bonuses */
1036 p_ptr->update |= (PU_BONUS);
1039 p_ptr->window |= (PW_EQUIP | PW_PLAYER);
1049 void mutate_player(void)
1051 int max1, cur1, max2, cur2, ii, jj, i;
1053 /* Pick a pair of stats */
1055 for (jj = ii; jj == ii; jj = randint0(6)) /* loop */;
1057 max1 = p_ptr->stat_max[ii];
1058 cur1 = p_ptr->stat_cur[ii];
1059 max2 = p_ptr->stat_max[jj];
1060 cur2 = p_ptr->stat_cur[jj];
1062 p_ptr->stat_max[ii] = max2;
1063 p_ptr->stat_cur[ii] = cur2;
1064 p_ptr->stat_max[jj] = max1;
1065 p_ptr->stat_cur[jj] = cur1;
1069 if(p_ptr->stat_max[i] > p_ptr->stat_max_max[i]) p_ptr->stat_max[i] = p_ptr->stat_max_max[i];
1070 if(p_ptr->stat_cur[i] > p_ptr->stat_max_max[i]) p_ptr->stat_cur[i] = p_ptr->stat_max_max[i];
1073 p_ptr->update |= (PU_BONUS);
1080 void apply_nexus(monster_type *m_ptr)
1082 switch (randint1(7))
1084 case 1: case 2: case 3:
1086 teleport_player(200, TRUE);
1092 teleport_player_to(m_ptr->fy, m_ptr->fx, TRUE, TRUE);
1098 if (randint0(100) < p_ptr->skill_sav)
1101 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
1103 msg_print("You resist the effects!");
1109 /* Teleport Level */
1116 if (randint0(100) < p_ptr->skill_sav)
1119 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
1121 msg_print("You resist the effects!");
1128 msg_print("ÂΤ¬¤Í¤¸¤ì»Ï¤á¤¿...");
1130 msg_print("Your body starts to scramble...");
1141 * Charge a lite (torch or latern)
1143 void phlogiston(void)
1146 object_type * o_ptr = &inventory[INVEN_LITE];
1149 if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_LANTERN))
1151 max_flog = FUEL_LAMP;
1155 else if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_TORCH))
1157 max_flog = FUEL_TORCH;
1160 /* No torch to refill */
1164 msg_print("dzÁǤò¾ÃÈñ¤¹¤ë¥¢¥¤¥Æ¥à¤òÁõÈ÷¤·¤Æ¤¤¤Þ¤»¤ó¡£");
1166 msg_print("You are not wielding anything which uses phlogiston.");
1172 if (o_ptr->xtra4 >= max_flog)
1175 msg_print("¤³¤Î¥¢¥¤¥Æ¥à¤Ë¤Ï¤³¤ì°Ê¾ådzÁǤòÊä½¼¤Ç¤¤Þ¤»¤ó¡£");
1177 msg_print("No more phlogiston can be put in this item.");
1184 o_ptr->xtra4 += (max_flog / 2);
1188 msg_print("¾ÈÌÀÍÑ¥¢¥¤¥Æ¥à¤ËdzÁǤòÊä½¼¤·¤¿¡£");
1190 msg_print("You add phlogiston to your light item.");
1195 if (o_ptr->xtra4 >= max_flog)
1197 o_ptr->xtra4 = max_flog;
1199 msg_print("¾ÈÌÀÍÑ¥¢¥¤¥Æ¥à¤ÏËþ¥¿¥ó¤Ë¤Ê¤Ã¤¿¡£");
1201 msg_print("Your light item is full.");
1206 /* Recalculate torch */
1207 p_ptr->update |= (PU_TORCH);
1212 * Brand the current weapon
1214 void brand_weapon(int brand_type)
1221 /* Assume enchant weapon */
1222 item_tester_hook = object_allow_enchant_melee_weapon;
1223 item_tester_no_ryoute = TRUE;
1227 q = "¤É¤ÎÉð´ï¤ò¶¯²½¤·¤Þ¤¹¤«? ";
1228 s = "¶¯²½¤Ç¤¤ëÉð´ï¤¬¤Ê¤¤¡£";
1230 q = "Enchant which weapon? ";
1231 s = "You have nothing to enchant.";
1234 if (!get_item(&item, q, s, (USE_EQUIP))) return;
1236 /* Get the item (in the pack) */
1239 o_ptr = &inventory[item];
1242 /* Get the item (on the floor) */
1245 o_ptr = &o_list[0 - item];
1249 /* you can never modify artifacts / ego-items */
1250 /* you can never modify cursed items */
1251 /* TY: You _can_ modify broken items (if you're silly enough) */
1252 if (o_ptr->k_idx && !object_is_artifact(o_ptr) && !object_is_ego(o_ptr) &&
1253 !object_is_cursed(o_ptr) &&
1254 !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) &&
1255 !((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE)) &&
1256 !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DIAMOND_EDGE)))
1260 /* Let's get the name before it is changed... */
1261 char o_name[MAX_NLEN];
1262 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1267 if (o_ptr->tval == TV_SWORD)
1270 act = "¤Ï±Ô¤µ¤òÁý¤·¤¿¡ª";
1272 act = "becomes very sharp!";
1275 o_ptr->name2 = EGO_SHARPNESS;
1276 o_ptr->pval = m_bonus(5, dun_level) + 1;
1281 act = "¤ÏÇ˲õÎϤòÁý¤·¤¿¡ª";
1283 act = "seems very powerful.";
1286 o_ptr->name2 = EGO_EARTHQUAKES;
1287 o_ptr->pval = m_bonus(3, dun_level);
1292 act = "¤Ï¿Í´Ö¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1294 act = "seems to be looking for humans!";
1297 o_ptr->name2 = EGO_SLAY_HUMAN;
1301 act = "¤ÏÅÅ·â¤Ëʤ¤ï¤ì¤¿¡ª";
1303 act = "covered with lightning!";
1306 o_ptr->name2 = EGO_BRAND_ELEC;
1310 act = "¤Ï»À¤Ëʤ¤ï¤ì¤¿¡ª";
1312 act = "coated with acid!";
1315 o_ptr->name2 = EGO_BRAND_ACID;
1319 act = "¤Ï¼Ù°¤Ê¤ë²øʪ¤òµá¤á¤Æ¤¤¤ë¡ª";
1321 act = "seems to be looking for evil monsters!";
1324 o_ptr->name2 = EGO_SLAY_EVIL;
1328 act = "¤Ï°ÛÀ¤³¦¤Î½»¿Í¤ÎÆùÂΤòµá¤á¤Æ¤¤¤ë¡ª";
1330 act = "seems to be looking for demons!";
1333 o_ptr->name2 = EGO_SLAY_DEMON;
1337 act = "¤Ï»Ó¤òµá¤á¤Æ¤¤¤ë¡ª";
1339 act = "seems to be looking for undead!";
1342 o_ptr->name2 = EGO_SLAY_UNDEAD;
1346 act = "¤Ïưʪ¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1348 act = "seems to be looking for animals!";
1351 o_ptr->name2 = EGO_SLAY_ANIMAL;
1355 act = "¤Ï¥É¥é¥´¥ó¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1357 act = "seems to be looking for dragons!";
1360 o_ptr->name2 = EGO_SLAY_DRAGON;
1364 act = "¤Ï¥È¥í¥ë¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1366 act = "seems to be looking for troll!s";
1369 o_ptr->name2 = EGO_SLAY_TROLL;
1373 act = "¤Ï¥ª¡¼¥¯¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1375 act = "seems to be looking for orcs!";
1378 o_ptr->name2 = EGO_SLAY_ORC;
1382 act = "¤Ïµð¿Í¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1384 act = "seems to be looking for giants!";
1387 o_ptr->name2 = EGO_SLAY_GIANT;
1391 act = "¤ÏÈó¾ï¤ËÉÔ°ÂÄê¤Ë¤Ê¤Ã¤¿¤è¤¦¤À¡£";
1393 act = "seems very unstable now.";
1396 o_ptr->name2 = EGO_TRUMP;
1397 o_ptr->pval = randint1(2);
1401 act = "¤Ï·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
1403 act = "thirsts for blood!";
1406 o_ptr->name2 = EGO_VAMPIRIC;
1410 act = "¤ÏÆǤËʤ¤ï¤ì¤¿¡£";
1412 act = "is coated with poison.";
1415 o_ptr->name2 = EGO_BRAND_POIS;
1419 act = "¤Ï½ã¥í¥°¥ë¥¹¤Ë°û¤ß¹þ¤Þ¤ì¤¿¡£";
1421 act = "is engulfed in raw Logrus!";
1424 o_ptr->name2 = EGO_CHAOTIC;
1428 act = "¤Ï±ê¤Î¥·¡¼¥ë¥É¤Ëʤ¤ï¤ì¤¿¡ª";
1430 act = "is covered in a fiery shield!";
1433 o_ptr->name2 = EGO_BRAND_FIRE;
1437 act = "¤Ï¿¼¤¯Î䤿¤¤¥Ö¥ë¡¼¤Ëµ±¤¤¤¿¡ª";
1439 act = "glows deep, icy blue!";
1442 o_ptr->name2 = EGO_BRAND_COLD;
1447 msg_format("¤¢¤Ê¤¿¤Î%s%s", o_name, act);
1449 msg_format("Your %s %s", o_name, act);
1453 enchant(o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
1455 o_ptr->discount = 99;
1456 chg_virtue(V_ENCHANT, 2);
1460 if (flush_failure) flush();
1463 msg_print("°ÀÉղä˼ºÇÔ¤·¤¿¡£");
1465 msg_print("The Branding failed.");
1468 chg_virtue(V_ENCHANT, -2);
1475 * Vanish all walls in this floor
1477 static bool vanish_dungeon(void)
1481 feature_type *f_ptr;
1482 monster_type *m_ptr;
1485 /* Prevent vasishing of quest levels and town */
1486 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1491 /* Scan all normal grids */
1492 for (y = 1; y < cur_hgt - 1; y++)
1494 for (x = 1; x < cur_wid - 1; x++)
1496 c_ptr = &cave[y][x];
1498 /* Seeing true feature code (ignore mimic) */
1499 f_ptr = &f_info[c_ptr->feat];
1501 /* Lose room and vault */
1502 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1504 m_ptr = &m_list[c_ptr->m_idx];
1507 if (c_ptr->m_idx && m_ptr->csleep)
1509 /* Reset sleep counter */
1512 /* Notice the "waking up" */
1515 /* Acquire the monster name */
1516 monster_desc(m_name, m_ptr, 0);
1518 /* Dump a message */
1520 msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
1522 msg_format("%^s wakes up.", m_name);
1528 /* Redraw the health bar */
1529 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
1530 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
1534 /* Process all walls, doors and patterns */
1535 if (have_flag(f_ptr->flags, FF_HURT_DISI)) cave_alter_feat(y, x, FF_HURT_DISI);
1539 /* Special boundary walls -- Top and bottom */
1540 for (x = 0; x < cur_wid; x++)
1542 c_ptr = &cave[0][x];
1543 f_ptr = &f_info[c_ptr->mimic];
1545 /* Lose room and vault */
1546 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1548 /* Set boundary mimic if needed */
1549 if (c_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI))
1551 c_ptr->mimic = feat_state(c_ptr->mimic, FF_HURT_DISI);
1553 /* Check for change to boring grid */
1554 if (!have_flag(f_info[c_ptr->mimic].flags, FF_REMEMBER)) c_ptr->info &= ~(CAVE_MARK);
1557 c_ptr = &cave[cur_hgt - 1][x];
1558 f_ptr = &f_info[c_ptr->mimic];
1560 /* Lose room and vault */
1561 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1563 /* Set boundary mimic if needed */
1564 if (c_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI))
1566 c_ptr->mimic = feat_state(c_ptr->mimic, FF_HURT_DISI);
1568 /* Check for change to boring grid */
1569 if (!have_flag(f_info[c_ptr->mimic].flags, FF_REMEMBER)) c_ptr->info &= ~(CAVE_MARK);
1573 /* Special boundary walls -- Left and right */
1574 for (y = 1; y < (cur_hgt - 1); y++)
1576 c_ptr = &cave[y][0];
1577 f_ptr = &f_info[c_ptr->mimic];
1579 /* Lose room and vault */
1580 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1582 /* Set boundary mimic if needed */
1583 if (c_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI))
1585 c_ptr->mimic = feat_state(c_ptr->mimic, FF_HURT_DISI);
1587 /* Check for change to boring grid */
1588 if (!have_flag(f_info[c_ptr->mimic].flags, FF_REMEMBER)) c_ptr->info &= ~(CAVE_MARK);
1591 c_ptr = &cave[y][cur_wid - 1];
1592 f_ptr = &f_info[c_ptr->mimic];
1594 /* Lose room and vault */
1595 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1597 /* Set boundary mimic if needed */
1598 if (c_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI))
1600 c_ptr->mimic = feat_state(c_ptr->mimic, FF_HURT_DISI);
1602 /* Check for change to boring grid */
1603 if (!have_flag(f_info[c_ptr->mimic].flags, FF_REMEMBER)) c_ptr->info &= ~(CAVE_MARK);
1607 /* Mega-Hack -- Forget the view and lite */
1608 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1611 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
1613 /* Update the monsters */
1614 p_ptr->update |= (PU_MONSTERS);
1617 p_ptr->redraw |= (PR_MAP);
1620 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1626 void call_the_(void)
1630 bool do_call = TRUE;
1632 for (i = 0; i < 9; i++)
1634 c_ptr = &cave[py + ddy_ddd[i]][px + ddx_ddd[i]];
1636 if (!cave_have_flag_grid(c_ptr, FF_PROJECT))
1638 if (!c_ptr->mimic || !have_flag(f_info[c_ptr->mimic].flags, FF_PROJECT) ||
1639 !permanent_wall(&f_info[c_ptr->feat]))
1649 for (i = 1; i < 10; i++)
1651 if (i - 5) fire_ball(GF_ROCKET, i, 175, 2);
1654 for (i = 1; i < 10; i++)
1656 if (i - 5) fire_ball(GF_MANA, i, 175, 3);
1659 for (i = 1; i < 10; i++)
1661 if (i - 5) fire_ball(GF_NUKE, i, 175, 4);
1665 /* Prevent destruction of quest levels and town */
1666 else if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1669 msg_print("ÃÏÌ̤¬Íɤ줿¡£");
1671 msg_print("The ground trembles.");
1678 msg_format("¤¢¤Ê¤¿¤Ï%s¤òÊɤ˶᤹¤®¤ë¾ì½ê¤Ç¾§¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª",
1679 ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "µ§¤ê" : "¼öʸ"));
1680 msg_print("Â礤ÊÇúȯ²»¤¬¤¢¤Ã¤¿¡ª");
1682 msg_format("You %s the %s too close to a wall!",
1683 ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "recite" : "cast"),
1684 ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "prayer" : "spell"));
1685 msg_print("There is a loud explosion!");
1691 if (!vanish_dungeon()) msg_print("¥À¥ó¥¸¥ç¥ó¤Ï°ì½ÖÀŤޤêÊ֤ä¿¡£");
1693 if (!vanish_dungeon()) msg_print("The dungeon silences a moment.");
1698 if (destroy_area(py, px, 15 + p_ptr->lev + randint0(11), FALSE))
1700 msg_print("¥À¥ó¥¸¥ç¥ó¤¬Êø²õ¤·¤¿...");
1702 msg_print("The dungeon collapses...");
1707 msg_print("¥À¥ó¥¸¥ç¥ó¤ÏÂ礤¯Íɤ줿¡£");
1709 msg_print("The dungeon trembles.");
1714 take_hit(DAMAGE_NOESCAPE, 100 + randint1(150), "¼«»¦Åª¤Êµõ̵¾·Íè", -1);
1716 take_hit(DAMAGE_NOESCAPE, 100 + randint1(150), "a suicidal Call the Void", -1);
1723 * Fetch an item (teleport it right underneath the caster)
1725 void fetch(int dir, int wgt, bool require_los)
1730 char o_name[MAX_NLEN];
1732 /* Check to see if an object is already there */
1733 if (cave[py][px].o_idx)
1736 msg_print("¼«Ê¬¤Î¤β¼¤Ë¤¢¤ëʪ¤Ï¼è¤ì¤Þ¤»¤ó¡£");
1738 msg_print("You can't fetch when you're already standing on something.");
1745 if (dir == 5 && target_okay())
1750 if (distance(py, px, ty, tx) > MAX_RANGE)
1753 msg_print("¤½¤ó¤Ê¤Ë±ó¤¯¤Ë¤¢¤ëʪ¤Ï¼è¤ì¤Þ¤»¤ó¡ª");
1755 msg_print("You can't fetch something that far away!");
1761 c_ptr = &cave[ty][tx];
1763 /* We need an item to fetch */
1767 msg_print("¤½¤³¤Ë¤Ï²¿¤â¤¢¤ê¤Þ¤»¤ó¡£");
1769 msg_print("There is no object at this place.");
1775 /* No fetching from vault */
1776 if (c_ptr->info & CAVE_ICKY)
1779 msg_print("¥¢¥¤¥Æ¥à¤¬¥³¥ó¥È¥í¡¼¥ë¤ò³°¤ì¤ÆÍî¤Á¤¿¡£");
1781 msg_print("The item slips from your control.");
1787 /* We need to see the item */
1790 if (!player_has_los_bold(ty, tx))
1793 msg_print("¤½¤³¤Ï¤¢¤Ê¤¿¤Î»ë³¦¤ËÆþ¤Ã¤Æ¤¤¤Þ¤»¤ó¡£");
1795 msg_print("You have no direct line of sight to that location.");
1800 else if (!projectable(py, px, ty, tx))
1803 msg_print("¤½¤³¤ÏÊɤθþ¤³¤¦¤Ç¤¹¡£");
1805 msg_print("You have no direct line of sight to that location.");
1814 /* Use a direction */
1815 ty = py; /* Where to drop the item */
1822 c_ptr = &cave[ty][tx];
1824 if ((distance(py, px, ty, tx) > MAX_RANGE) ||
1825 !cave_have_flag_bold(ty, tx, FF_PROJECT)) return;
1827 while (!c_ptr->o_idx);
1830 o_ptr = &o_list[c_ptr->o_idx];
1832 if (o_ptr->weight > wgt)
1834 /* Too heavy to 'fetch' */
1836 msg_print("¤½¤Î¥¢¥¤¥Æ¥à¤Ï½Å²á¤®¤Þ¤¹¡£");
1838 msg_print("The object is too heavy.");
1845 c_ptr->o_idx = o_ptr->next_o_idx;
1846 cave[py][px].o_idx = i; /* 'move' it */
1847 o_ptr->next_o_idx = 0;
1848 o_ptr->iy = (byte)py;
1849 o_ptr->ix = (byte)px;
1851 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1853 msg_format("%^s¤¬¤¢¤Ê¤¿¤Î¸µ¤ËÈô¤ó¤Ç¤¤¿¡£", o_name);
1855 msg_format("%^s flies through the air to your feet.", o_name);
1860 p_ptr->redraw |= PR_MAP;
1864 void alter_reality(void)
1866 /* Ironman option */
1867 if (p_ptr->inside_arena || ironman_downward)
1870 msg_print("²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
1872 msg_print("Nothing happens.");
1877 if (!p_ptr->alter_reality)
1879 int turns = randint0(21) + 15;
1881 p_ptr->alter_reality = turns;
1883 msg_print("²ó¤ê¤Î·Ê¿§¤¬ÊѤï¤ê»Ï¤á¤¿...");
1885 msg_print("The view around you begins to change...");
1888 p_ptr->redraw |= (PR_STATUS);
1892 p_ptr->alter_reality = 0;
1894 msg_print("·Ê¿§¤¬¸µ¤ËÌá¤Ã¤¿...");
1896 msg_print("The view around you got back...");
1899 p_ptr->redraw |= (PR_STATUS);
1906 * Leave a "glyph of warding" which prevents monster movement
1908 bool warding_glyph(void)
1911 if (!cave_clean_bold(py, px))
1914 msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£");
1916 msg_print("The object resists the spell.");
1922 /* Create a glyph */
1923 cave[py][px].info |= CAVE_OBJECT;
1924 cave[py][px].mimic = FEAT_GLYPH;
1935 bool place_mirror(void)
1938 if (!cave_clean_bold(py, px))
1941 msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£");
1943 msg_print("The object resists the spell.");
1949 /* Create a mirror */
1950 cave[py][px].info |= CAVE_OBJECT;
1951 cave[py][px].mimic = FEAT_MIRROR;
1953 /* Turn on the light */
1954 cave[py][px].info |= CAVE_GLOW;
1962 update_local_illumination(py, px);
1969 * Leave an "explosive rune" which prevents monster movement
1971 bool explosive_rune(void)
1974 if (!cave_clean_bold(py, px))
1977 msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£");
1979 msg_print("The object resists the spell.");
1985 /* Create a glyph */
1986 cave[py][px].info |= CAVE_OBJECT;
1987 cave[py][px].mimic = FEAT_MINOR_GLYPH;
2000 * Identify everything being carried.
2001 * Done by a potion of "self knowledge".
2003 void identify_pack(void)
2007 /* Simply identify and know every item */
2008 for (i = 0; i < INVEN_TOTAL; i++)
2010 object_type *o_ptr = &inventory[i];
2012 /* Skip non-objects */
2013 if (!o_ptr->k_idx) continue;
2016 identify_item(o_ptr);
2018 /* Auto-inscription */
2019 autopick_alter_item(i, FALSE);
2025 * Used by the "enchant" function (chance of failure)
2026 * (modified for Zangband, we need better stuff there...) -- TY
2028 static int enchant_table[16] =
2030 0, 10, 50, 100, 200,
2031 300, 400, 500, 650, 800,
2032 950, 987, 993, 995, 998,
2038 * Removes curses from items in inventory
2040 * Note that Items which are "Perma-Cursed" (The One Ring,
2041 * The Crown of Morgoth) can NEVER be uncursed.
2043 * Note that if "all" is FALSE, then Items which are
2044 * "Heavy-Cursed" (Mormegil, Calris, and Weapons of Morgul)
2045 * will not be uncursed.
2047 static int remove_curse_aux(int all)
2051 /* Attempt to uncurse items being worn */
2052 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2054 object_type *o_ptr = &inventory[i];
2056 /* Skip non-objects */
2057 if (!o_ptr->k_idx) continue;
2059 /* Uncursed already */
2060 if (!object_is_cursed(o_ptr)) continue;
2062 /* Heavily Cursed Items need a special spell */
2063 if (!all && (o_ptr->curse_flags & TRC_HEAVY_CURSE)) continue;
2065 /* Perma-Cursed Items can NEVER be uncursed */
2066 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
2069 o_ptr->curse_flags &= (TRC_CURSED | TRC_HEAVY_CURSE | TRC_PERMA_CURSE);
2074 o_ptr->curse_flags = 0L;
2076 /* Hack -- Assume felt */
2077 o_ptr->ident |= (IDENT_SENSE);
2080 o_ptr->feeling = FEEL_NONE;
2082 /* Recalculate the bonuses */
2083 p_ptr->update |= (PU_BONUS);
2086 p_ptr->window |= (PW_EQUIP);
2088 /* Count the uncursings */
2092 /* Return "something uncursed" */
2098 * Remove most curses
2100 bool remove_curse(void)
2102 return (remove_curse_aux(FALSE));
2108 bool remove_all_curse(void)
2110 return (remove_curse_aux(TRUE));
2115 * Turns an object into gold, gain some of its value in a shop
2124 char o_name[MAX_NLEN];
2125 char out_val[MAX_NLEN+40];
2129 /* Hack -- force destruction */
2130 if (command_arg > 0) force = TRUE;
2134 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò¶â¤ËÊѤ¨¤Þ¤¹¤«¡©";
2135 s = "¶â¤ËÊѤ¨¤é¤ì¤ëʪ¤¬¤¢¤ê¤Þ¤»¤ó¡£";
2137 q = "Turn which item to gold? ";
2138 s = "You have nothing to turn to gold.";
2141 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return (FALSE);
2143 /* Get the item (in the pack) */
2146 o_ptr = &inventory[item];
2149 /* Get the item (on the floor) */
2152 o_ptr = &o_list[0 - item];
2156 /* See how many items */
2157 if (o_ptr->number > 1)
2159 /* Get a quantity */
2160 amt = get_quantity(NULL, o_ptr->number);
2162 /* Allow user abort */
2163 if (amt <= 0) return FALSE;
2167 /* Describe the object */
2168 old_number = o_ptr->number;
2169 o_ptr->number = amt;
2170 object_desc(o_name, o_ptr, 0);
2171 o_ptr->number = old_number;
2173 /* Verify unless quantity given */
2176 if (confirm_destroy || (object_value(o_ptr) > 0))
2178 /* Make a verification */
2180 sprintf(out_val, "ËÜÅö¤Ë%s¤ò¶â¤ËÊѤ¨¤Þ¤¹¤«¡©", o_name);
2182 sprintf(out_val, "Really turn %s to gold? ", o_name);
2185 if (!get_check(out_val)) return FALSE;
2189 /* Artifacts cannot be destroyed */
2190 if (!can_player_destroy_object(o_ptr))
2194 msg_format("%s¤ò¶â¤ËÊѤ¨¤ë¤³¤È¤Ë¼ºÇÔ¤·¤¿¡£", o_name);
2196 msg_format("You fail to turn %s to gold!", o_name);
2203 price = object_value_real(o_ptr);
2209 msg_format("%s¤ò¥Ë¥»¤Î¶â¤ËÊѤ¨¤¿¡£", o_name);
2211 msg_format("You turn %s to fool's gold.", o_name);
2219 if (amt > 1) price *= amt;
2221 if (price > 30000) price = 30000;
2223 msg_format("%s¤ò¡ð%d ¤Î¶â¤ËÊѤ¨¤¿¡£", o_name, price);
2225 msg_format("You turn %s to %ld coins worth of gold.", o_name, price);
2231 p_ptr->redraw |= (PR_GOLD);
2234 p_ptr->window |= (PW_PLAYER);
2238 /* Eliminate the item (from the pack) */
2241 inven_item_increase(item, -amt);
2242 inven_item_describe(item);
2243 inven_item_optimize(item);
2246 /* Eliminate the item (from the floor) */
2249 floor_item_increase(0 - item, -amt);
2250 floor_item_describe(0 - item);
2251 floor_item_optimize(0 - item);
2259 * Break the curse of an item
2261 static void break_curse(object_type *o_ptr)
2263 if (object_is_cursed(o_ptr) && !(o_ptr->curse_flags & TRC_PERMA_CURSE) && !(o_ptr->curse_flags & TRC_HEAVY_CURSE) && (randint0(100) < 25))
2266 msg_print("¤«¤±¤é¤ì¤Æ¤¤¤¿¼ö¤¤¤¬ÂǤÁÇˤé¤ì¤¿¡ª");
2268 msg_print("The curse is broken!");
2271 o_ptr->curse_flags = 0L;
2273 o_ptr->ident |= (IDENT_SENSE);
2275 o_ptr->feeling = FEEL_NONE;
2281 * Enchants a plus onto an item. -RAK-
2283 * Revamped! Now takes item pointer, number of times to try enchanting,
2284 * and a flag of what to try enchanting. Artifacts resist enchantment
2285 * some of the time, and successful enchantment to at least +0 might
2286 * break a curse on the item. -CFT-
2288 * Note that an item can technically be enchanted all the way to +15 if
2289 * you wait a very, very, long time. Going from +9 to +10 only works
2290 * about 5% of the time, and from +10 to +11 only about 1% of the time.
2292 * Note that this function can now be used on "piles" of items, and
2293 * the larger the pile, the lower the chance of success.
2295 bool enchant(object_type *o_ptr, int n, int eflag)
2297 int i, chance, prob;
2299 bool a = object_is_artifact(o_ptr);
2300 bool force = (eflag & ENCH_FORCE);
2303 /* Large piles resist enchantment */
2304 prob = o_ptr->number * 100;
2306 /* Missiles are easy to enchant */
2307 if ((o_ptr->tval == TV_BOLT) ||
2308 (o_ptr->tval == TV_ARROW) ||
2309 (o_ptr->tval == TV_SHOT))
2315 for (i = 0; i < n; i++)
2317 /* Hack -- Roll for pile resistance */
2318 if (!force && randint0(prob) >= 100) continue;
2320 /* Enchant to hit */
2321 if (eflag & ENCH_TOHIT)
2323 if (o_ptr->to_h < 0) chance = 0;
2324 else if (o_ptr->to_h > 15) chance = 1000;
2325 else chance = enchant_table[o_ptr->to_h];
2327 if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
2332 /* only when you get it above -1 -CFT */
2333 if (o_ptr->to_h >= 0)
2338 /* Enchant to damage */
2339 if (eflag & ENCH_TODAM)
2341 if (o_ptr->to_d < 0) chance = 0;
2342 else if (o_ptr->to_d > 15) chance = 1000;
2343 else chance = enchant_table[o_ptr->to_d];
2345 if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
2350 /* only when you get it above -1 -CFT */
2351 if (o_ptr->to_d >= 0)
2356 /* Enchant to armor class */
2357 if (eflag & ENCH_TOAC)
2359 if (o_ptr->to_a < 0) chance = 0;
2360 else if (o_ptr->to_a > 15) chance = 1000;
2361 else chance = enchant_table[o_ptr->to_a];
2363 if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
2368 /* only when you get it above -1 -CFT */
2369 if (o_ptr->to_a >= 0)
2376 if (!res) return (FALSE);
2378 /* Recalculate bonuses */
2379 p_ptr->update |= (PU_BONUS);
2381 /* Combine / Reorder the pack (later) */
2382 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2385 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2396 * Enchant an item (in the inventory or on the floor)
2397 * Note that "num_ac" requires armour, else weapon
2398 * Returns TRUE if attempted, FALSE if cancelled
2400 bool enchant_spell(int num_hit, int num_dam, int num_ac)
2405 char o_name[MAX_NLEN];
2409 /* Assume enchant weapon */
2410 item_tester_hook = object_allow_enchant_weapon;
2411 item_tester_no_ryoute = TRUE;
2413 /* Enchant armor if requested */
2414 if (num_ac) item_tester_hook = object_is_armour;
2418 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò¶¯²½¤·¤Þ¤¹¤«? ";
2419 s = "¶¯²½¤Ç¤¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2421 q = "Enchant which item? ";
2422 s = "You have nothing to enchant.";
2425 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2427 /* Get the item (in the pack) */
2430 o_ptr = &inventory[item];
2433 /* Get the item (on the floor) */
2436 o_ptr = &o_list[0 - item];
2441 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2445 msg_format("%s ¤ÏÌÀ¤ë¤¯µ±¤¤¤¿¡ª",
2448 msg_format("%s %s glow%s brightly!",
2449 ((item >= 0) ? "Your" : "The"), o_name,
2450 ((o_ptr->number > 1) ? "" : "s"));
2455 if (enchant(o_ptr, num_hit, ENCH_TOHIT)) okay = TRUE;
2456 if (enchant(o_ptr, num_dam, ENCH_TODAM)) okay = TRUE;
2457 if (enchant(o_ptr, num_ac, ENCH_TOAC)) okay = TRUE;
2463 if (flush_failure) flush();
2467 msg_print("¶¯²½¤Ë¼ºÇÔ¤·¤¿¡£");
2469 msg_print("The enchantment failed.");
2472 if (one_in_(3)) chg_virtue(V_ENCHANT, -1);
2475 chg_virtue(V_ENCHANT, 1);
2479 /* Something happened */
2485 * Check if an object is nameless weapon or armour
2487 static bool item_tester_hook_nameless_weapon_armour(object_type *o_ptr)
2489 /* Require weapon or armour */
2490 if (!object_is_weapon_armour_ammo(o_ptr)) return FALSE;
2492 /* Require nameless object if the object is well known */
2493 if (object_is_known(o_ptr) && !object_is_nameless(o_ptr))
2500 bool artifact_scroll(void)
2505 char o_name[MAX_NLEN];
2509 item_tester_no_ryoute = TRUE;
2511 /* Enchant weapon/armour */
2512 item_tester_hook = item_tester_hook_nameless_weapon_armour;
2516 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò¶¯²½¤·¤Þ¤¹¤«? ";
2517 s = "¶¯²½¤Ç¤¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2519 q = "Enchant which item? ";
2520 s = "You have nothing to enchant.";
2523 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2525 /* Get the item (in the pack) */
2528 o_ptr = &inventory[item];
2531 /* Get the item (on the floor) */
2534 o_ptr = &o_list[0 - item];
2539 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2543 msg_format("%s ¤ÏâÁ¤¤¸÷¤òȯ¤·¤¿¡ª",o_name);
2545 msg_format("%s %s radiate%s a blinding light!",
2546 ((item >= 0) ? "Your" : "The"), o_name,
2547 ((o_ptr->number > 1) ? "" : "s"));
2550 if (object_is_artifact(o_ptr))
2553 msg_format("%s¤Ï´û¤ËÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Ç¤¹¡ª", o_name );
2555 msg_format("The %s %s already %s!",
2556 o_name, ((o_ptr->number > 1) ? "are" : "is"),
2557 ((o_ptr->number > 1) ? "artifacts" : "an artifact"));
2563 else if (object_is_ego(o_ptr))
2566 msg_format("%s¤Ï´û¤Ë̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à¤Ç¤¹¡ª", o_name );
2568 msg_format("The %s %s already %s!",
2569 o_name, ((o_ptr->number > 1) ? "are" : "is"),
2570 ((o_ptr->number > 1) ? "ego items" : "an ego item"));
2576 else if (o_ptr->xtra3)
2579 msg_format("%s¤Ï´û¤Ë¶¯²½¤µ¤ì¤Æ¤¤¤Þ¤¹¡ª", o_name );
2581 msg_format("The %s %s already %s!",
2582 o_name, ((o_ptr->number > 1) ? "are" : "is"),
2583 ((o_ptr->number > 1) ? "customized items" : "a customized item"));
2589 if (o_ptr->number > 1)
2592 msg_print("Ê£¿ô¤Î¥¢¥¤¥Æ¥à¤ËËâË¡¤ò¤«¤±¤ë¤À¤±¤Î¥¨¥Í¥ë¥®¡¼¤Ï¤¢¤ê¤Þ¤»¤ó¡ª");
2593 msg_format("%d ¸Ä¤Î%s¤¬²õ¤ì¤¿¡ª",(o_ptr->number)-1, o_name);
2595 msg_print("Not enough enough energy to enchant more than one object!");
2596 msg_format("%d of your %s %s destroyed!",(o_ptr->number)-1, o_name, (o_ptr->number>2?"were":"was"));
2601 inven_item_increase(item, 1-(o_ptr->number));
2605 floor_item_increase(0-item, 1-(o_ptr->number));
2608 okay = create_artifact(o_ptr, TRUE);
2615 if (flush_failure) flush();
2619 msg_print("¶¯²½¤Ë¼ºÇÔ¤·¤¿¡£");
2621 msg_print("The enchantment failed.");
2624 if (one_in_(3)) chg_virtue(V_ENCHANT, -1);
2627 chg_virtue(V_ENCHANT, 1);
2631 /* Something happened */
2637 * Identify an object
2639 bool identify_item(object_type *o_ptr)
2641 bool old_known = FALSE;
2642 char o_name[MAX_NLEN];
2645 object_desc(o_name, o_ptr, 0);
2647 if (o_ptr->ident & IDENT_KNOWN)
2650 if (!(o_ptr->ident & (IDENT_MENTAL)))
2652 if (object_is_artifact(o_ptr) || one_in_(5))
2653 chg_virtue(V_KNOWLEDGE, 1);
2656 /* Identify it fully */
2657 object_aware(o_ptr);
2658 object_known(o_ptr);
2660 /* Recalculate bonuses */
2661 p_ptr->update |= (PU_BONUS);
2663 /* Combine / Reorder the pack (later) */
2664 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2667 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2669 strcpy(record_o_name, o_name);
2673 object_desc(o_name, o_ptr, OD_NAME_ONLY);
2675 if(record_fix_art && !old_known && object_is_fixed_artifact(o_ptr))
2676 do_cmd_write_nikki(NIKKI_ART, 0, o_name);
2677 if(record_rand_art && !old_known && o_ptr->art_name)
2678 do_cmd_write_nikki(NIKKI_ART, 0, o_name);
2684 static bool item_tester_hook_identify(object_type *o_ptr)
2686 return (bool)!object_is_known(o_ptr);
2689 static bool item_tester_hook_identify_weapon_armour(object_type *o_ptr)
2691 if (object_is_known(o_ptr))
2693 return object_is_weapon_armour_ammo(o_ptr);
2697 * Identify an object in the inventory (or on the floor)
2698 * This routine does *not* automatically combine objects.
2699 * Returns TRUE if something was identified, else FALSE.
2701 bool ident_spell(bool only_equip)
2705 char o_name[MAX_NLEN];
2709 item_tester_no_ryoute = TRUE;
2712 item_tester_hook = item_tester_hook_identify_weapon_armour;
2714 item_tester_hook = item_tester_hook_identify;
2716 if (!can_get_item())
2720 item_tester_hook = object_is_weapon_armour_ammo;
2724 item_tester_hook = NULL;
2730 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò´ÕÄꤷ¤Þ¤¹¤«? ";
2731 s = "´ÕÄꤹ¤ë¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2733 q = "Identify which item? ";
2734 s = "You have nothing to identify.";
2737 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2739 /* Get the item (in the pack) */
2742 o_ptr = &inventory[item];
2745 /* Get the item (on the floor) */
2748 o_ptr = &o_list[0 - item];
2752 old_known = identify_item(o_ptr);
2755 object_desc(o_name, o_ptr, 0);
2758 if (item >= INVEN_RARM)
2761 msg_format("%^s: %s(%c)¡£", describe_use(item), o_name, index_to_label(item));
2763 msg_format("%^s: %s (%c).", describe_use(item), o_name, index_to_label(item));
2769 msg_format("¥¶¥Ã¥¯Ãæ: %s(%c)¡£", o_name, index_to_label(item));
2771 msg_format("In your pack: %s (%c).", o_name, index_to_label(item));
2777 msg_format("¾²¾å: %s¡£", o_name);
2779 msg_format("On the ground: %s.", o_name);
2783 /* Auto-inscription/destroy */
2784 autopick_alter_item(item, (bool)(destroy_identify && !old_known));
2786 /* Something happened */
2792 * Mundanify an object in the inventory (or on the floor)
2793 * This routine does *not* automatically combine objects.
2794 * Returns TRUE if something was mundanified, else FALSE.
2796 bool mundane_spell(bool only_equip)
2802 if (only_equip) item_tester_hook = object_is_weapon_armour_ammo;
2803 item_tester_no_ryoute = TRUE;
2807 q = "¤É¤ì¤ò»È¤¤¤Þ¤¹¤«¡©";
2808 s = "»È¤¨¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
2810 q = "Use which item? ";
2811 s = "You have nothing you can use.";
2814 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2816 /* Get the item (in the pack) */
2819 o_ptr = &inventory[item];
2822 /* Get the item (on the floor) */
2825 o_ptr = &o_list[0 - item];
2830 msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
2832 msg_print("There is a bright flash of light!");
2835 byte iy = o_ptr->iy; /* Y-position on map, or zero */
2836 byte ix = o_ptr->ix; /* X-position on map, or zero */
2837 s16b next_o_idx = o_ptr->next_o_idx; /* Next object in stack (if any) */
2838 byte marked = o_ptr->marked; /* Object is marked */
2839 s16b weight = o_ptr->number * o_ptr->weight;
2840 u16b inscription = o_ptr->inscription;
2843 object_prep(o_ptr, o_ptr->k_idx);
2847 o_ptr->next_o_idx = next_o_idx;
2848 o_ptr->marked = marked;
2849 o_ptr->inscription = inscription;
2850 if (item >= 0) p_ptr->total_weight += (o_ptr->weight - weight);
2854 /* Something happened */
2860 static bool item_tester_hook_identify_fully(object_type *o_ptr)
2862 return (bool)(!object_is_known(o_ptr) || !(o_ptr->ident & IDENT_MENTAL));
2865 static bool item_tester_hook_identify_fully_weapon_armour(object_type *o_ptr)
2867 if (!item_tester_hook_identify_fully(o_ptr))
2869 return object_is_weapon_armour_ammo(o_ptr);
2873 * Fully "identify" an object in the inventory -BEN-
2874 * This routine returns TRUE if an item was identified.
2876 bool identify_fully(bool only_equip)
2880 char o_name[MAX_NLEN];
2884 item_tester_no_ryoute = TRUE;
2886 item_tester_hook = item_tester_hook_identify_fully_weapon_armour;
2888 item_tester_hook = item_tester_hook_identify_fully;
2890 if (!can_get_item())
2893 item_tester_hook = object_is_weapon_armour_ammo;
2895 item_tester_hook = NULL;
2900 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò´ÕÄꤷ¤Þ¤¹¤«? ";
2901 s = "´ÕÄꤹ¤ë¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
2903 q = "Identify which item? ";
2904 s = "You have nothing to identify.";
2907 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
2909 /* Get the item (in the pack) */
2912 o_ptr = &inventory[item];
2915 /* Get the item (on the floor) */
2918 o_ptr = &o_list[0 - item];
2922 old_known = identify_item(o_ptr);
2924 /* Mark the item as fully known */
2925 o_ptr->ident |= (IDENT_MENTAL);
2931 object_desc(o_name, o_ptr, 0);
2934 if (item >= INVEN_RARM)
2937 msg_format("%^s: %s(%c)¡£", describe_use(item), o_name, index_to_label(item));
2939 msg_format("%^s: %s (%c).", describe_use(item), o_name, index_to_label(item));
2947 msg_format("¥¶¥Ã¥¯Ãæ: %s(%c)¡£", o_name, index_to_label(item));
2949 msg_format("In your pack: %s (%c).", o_name, index_to_label(item));
2955 msg_format("¾²¾å: %s¡£", o_name);
2957 msg_format("On the ground: %s.", o_name);
2961 /* Describe it fully */
2962 (void)screen_object(o_ptr, TRUE);
2964 /* Auto-inscription/destroy */
2965 autopick_alter_item(item, (bool)(destroy_identify && !old_known));
2975 * Hook for "get_item()". Determine if something is rechargable.
2977 bool item_tester_hook_recharge(object_type *o_ptr)
2979 /* Recharge staffs */
2980 if (o_ptr->tval == TV_STAFF) return (TRUE);
2982 /* Recharge wands */
2983 if (o_ptr->tval == TV_WAND) return (TRUE);
2985 /* Hack -- Recharge rods */
2986 if (o_ptr->tval == TV_ROD) return (TRUE);
2994 * Recharge a wand/staff/rod from the pack or on the floor.
2995 * This function has been rewritten in Oangband and ZAngband.
2997 * Sorcery/Arcane -- Recharge --> recharge(plev * 4)
2998 * Chaos -- Arcane Binding --> recharge(90)
3000 * Scroll of recharging --> recharge(130)
3001 * Artifact activation/Thingol --> recharge(130)
3003 * It is harder to recharge high level, and highly charged wands,
3004 * staffs, and rods. The more wands in a stack, the more easily and
3005 * strongly they recharge. Staffs, however, each get fewer charges if
3008 * XXX XXX XXX Beware of "sliding index errors".
3010 bool recharge(int power)
3013 int recharge_strength, recharge_amount;
3022 char o_name[MAX_NLEN];
3024 /* Only accept legal items */
3025 item_tester_hook = item_tester_hook_recharge;
3029 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ËËâÎϤò½¼Å¶¤·¤Þ¤¹¤«? ";
3030 s = "ËâÎϤò½¼Å¶¤¹¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
3032 q = "Recharge which item? ";
3033 s = "You have nothing to recharge.";
3036 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return (FALSE);
3038 /* Get the item (in the pack) */
3041 o_ptr = &inventory[item];
3044 /* Get the item (on the floor) */
3047 o_ptr = &o_list[0 - item];
3050 /* Get the object kind. */
3051 k_ptr = &k_info[o_ptr->k_idx];
3053 /* Extract the object "level" */
3054 lev = k_info[o_ptr->k_idx].level;
3057 /* Recharge a rod */
3058 if (o_ptr->tval == TV_ROD)
3060 /* Extract a recharge strength by comparing object level to power. */
3061 recharge_strength = ((power > lev/2) ? (power - lev/2) : 0) / 5;
3065 if (one_in_(recharge_strength))
3067 /* Activate the failure code. */
3074 /* Recharge amount */
3075 recharge_amount = (power * damroll(3, 2));
3077 /* Recharge by that amount */
3078 if (o_ptr->timeout > recharge_amount)
3079 o_ptr->timeout -= recharge_amount;
3086 /* Recharge wand/staff */
3089 /* Extract a recharge strength by comparing object level to power.
3090 * Divide up a stack of wands' charges to calculate charge penalty.
3092 if ((o_ptr->tval == TV_WAND) && (o_ptr->number > 1))
3093 recharge_strength = (100 + power - lev -
3094 (8 * o_ptr->pval / o_ptr->number)) / 15;
3096 /* All staffs, unstacked wands. */
3097 else recharge_strength = (100 + power - lev -
3098 (8 * o_ptr->pval)) / 15;
3101 if (recharge_strength < 0) recharge_strength = 0;
3104 if (one_in_(recharge_strength))
3106 /* Activate the failure code. */
3110 /* If the spell didn't backfire, recharge the wand or staff. */
3113 /* Recharge based on the standard number of charges. */
3114 recharge_amount = randint1(1 + k_ptr->pval / 2);
3116 /* Multiple wands in a stack increase recharging somewhat. */
3117 if ((o_ptr->tval == TV_WAND) && (o_ptr->number > 1))
3120 (randint1(recharge_amount * (o_ptr->number - 1))) / 2;
3121 if (recharge_amount < 1) recharge_amount = 1;
3122 if (recharge_amount > 12) recharge_amount = 12;
3125 /* But each staff in a stack gets fewer additional charges,
3126 * although always at least one.
3128 if ((o_ptr->tval == TV_STAFF) && (o_ptr->number > 1))
3130 recharge_amount /= o_ptr->number;
3131 if (recharge_amount < 1) recharge_amount = 1;
3134 /* Recharge the wand or staff. */
3135 o_ptr->pval += recharge_amount;
3138 /* Hack -- we no longer "know" the item */
3139 o_ptr->ident &= ~(IDENT_KNOWN);
3141 /* Hack -- we no longer think the item is empty */
3142 o_ptr->ident &= ~(IDENT_EMPTY);
3147 /* Inflict the penalties for failing a recharge. */
3150 /* Artifacts are never destroyed. */
3151 if (object_is_fixed_artifact(o_ptr))
3153 object_desc(o_name, o_ptr, OD_NAME_ONLY);
3155 msg_format("ËâÎϤ¬µÕή¤·¤¿¡ª%s¤Ï´°Á´¤ËËâÎϤò¼º¤Ã¤¿¡£", o_name);
3157 msg_format("The recharging backfires - %s is completely drained!", o_name);
3161 /* Artifact rods. */
3162 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout < 10000))
3163 o_ptr->timeout = (o_ptr->timeout + 100) * 2;
3165 /* Artifact wands and staffs. */
3166 else if ((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_STAFF))
3171 /* Get the object description */
3172 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
3174 /*** Determine Seriousness of Failure ***/
3176 /* Mages recharge objects more safely. */
3177 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)
3179 /* 10% chance to blow up one rod, otherwise draining. */
3180 if (o_ptr->tval == TV_ROD)
3182 if (one_in_(10)) fail_type = 2;
3185 /* 75% chance to blow up one wand, otherwise draining. */
3186 else if (o_ptr->tval == TV_WAND)
3188 if (!one_in_(3)) fail_type = 2;
3191 /* 50% chance to blow up one staff, otherwise no effect. */
3192 else if (o_ptr->tval == TV_STAFF)
3194 if (one_in_(2)) fail_type = 2;
3199 /* All other classes get no special favors. */
3202 /* 33% chance to blow up one rod, otherwise draining. */
3203 if (o_ptr->tval == TV_ROD)
3205 if (one_in_(3)) fail_type = 2;
3208 /* 20% chance of the entire stack, else destroy one wand. */
3209 else if (o_ptr->tval == TV_WAND)
3211 if (one_in_(5)) fail_type = 3;
3214 /* Blow up one staff. */
3215 else if (o_ptr->tval == TV_STAFF)
3221 /*** Apply draining and destruction. ***/
3223 /* Drain object or stack of objects. */
3226 if (o_ptr->tval == TV_ROD)
3229 msg_print("ËâÎϤ¬µÕÊ®¼Í¤·¤Æ¡¢¥í¥Ã¥É¤«¤é¤µ¤é¤ËËâÎϤòµÛ¤¤¼è¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
3231 msg_print("The recharge backfires, draining the rod further!");
3234 if (o_ptr->timeout < 10000)
3235 o_ptr->timeout = (o_ptr->timeout + 100) * 2;
3237 else if (o_ptr->tval == TV_WAND)
3240 msg_format("%s¤ÏÇË»¤òÌȤ줿¤¬¡¢ËâÎϤ¬Á´¤Æ¼º¤ï¤ì¤¿¡£", o_name);
3242 msg_format("You save your %s from destruction, but all charges are lost.", o_name);
3247 /* Staffs aren't drained. */
3250 /* Destroy an object or one in a stack of objects. */
3253 if (o_ptr->number > 1)
3255 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬°ìËܲõ¤ì¤¿¡ª", o_name);
3257 msg_format("Wild magic consumes one of your %s!", o_name);
3262 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²õ¤ì¤¿¡ª", o_name);
3264 msg_format("Wild magic consumes your %s!", o_name);
3268 /* Reduce rod stack maximum timeout, drain wands. */
3269 if (o_ptr->tval == TV_ROD) o_ptr->timeout = (o_ptr->number - 1) * k_ptr->pval;
3270 if (o_ptr->tval == TV_WAND) o_ptr->pval = 0;
3272 /* Reduce and describe inventory */
3275 inven_item_increase(item, -1);
3276 inven_item_describe(item);
3277 inven_item_optimize(item);
3280 /* Reduce and describe floor item */
3283 floor_item_increase(0 - item, -1);
3284 floor_item_describe(0 - item);
3285 floor_item_optimize(0 - item);
3289 /* Destroy all members of a stack of objects. */
3292 if (o_ptr->number > 1)
3294 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬Á´¤Æ²õ¤ì¤¿¡ª", o_name);
3296 msg_format("Wild magic consumes all your %s!", o_name);
3301 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²õ¤ì¤¿¡ª", o_name);
3303 msg_format("Wild magic consumes your %s!", o_name);
3308 /* Reduce and describe inventory */
3311 inven_item_increase(item, -999);
3312 inven_item_describe(item);
3313 inven_item_optimize(item);
3316 /* Reduce and describe floor item */
3319 floor_item_increase(0 - item, -999);
3320 floor_item_describe(0 - item);
3321 floor_item_optimize(0 - item);
3327 /* Combine / Reorder the pack (later) */
3328 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
3331 p_ptr->window |= (PW_INVEN);
3333 /* Something was done */
3341 bool bless_weapon(void)
3345 u32b flgs[TR_FLAG_SIZE];
3346 char o_name[MAX_NLEN];
3349 item_tester_no_ryoute = TRUE;
3351 /* Bless only weapons */
3352 item_tester_hook = object_is_weapon;
3356 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò½ËÊ¡¤·¤Þ¤¹¤«¡©";
3357 s = "½ËÊ¡¤Ç¤¤ëÉð´ï¤¬¤¢¤ê¤Þ¤»¤ó¡£";
3359 q = "Bless which weapon? ";
3360 s = "You have weapon to bless.";
3363 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR)))
3366 /* Get the item (in the pack) */
3369 o_ptr = &inventory[item];
3372 /* Get the item (on the floor) */
3375 o_ptr = &o_list[0 - item];
3380 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
3382 /* Extract the flags */
3383 object_flags(o_ptr, flgs);
3385 if (object_is_cursed(o_ptr))
3387 if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && (randint1(100) < 33)) ||
3388 (o_ptr->curse_flags & TRC_PERMA_CURSE))
3391 msg_format("%s¤òʤ¤¦¹õ¤¤¥ª¡¼¥é¤Ï½ËÊ¡¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
3394 msg_format("The black aura on %s %s disrupts the blessing!",
3395 ((item >= 0) ? "your" : "the"), o_name);
3402 msg_format("%s ¤«¤é¼Ù°¤Ê¥ª¡¼¥é¤¬¾Ã¤¨¤¿¡£",
3405 msg_format("A malignant aura leaves %s %s.",
3406 ((item >= 0) ? "your" : "the"), o_name);
3411 o_ptr->curse_flags = 0L;
3413 /* Hack -- Assume felt */
3414 o_ptr->ident |= (IDENT_SENSE);
3417 o_ptr->feeling = FEEL_NONE;
3419 /* Recalculate the bonuses */
3420 p_ptr->update |= (PU_BONUS);
3423 p_ptr->window |= (PW_EQUIP);
3427 * Next, we try to bless it. Artifacts have a 1/3 chance of
3428 * being blessed, otherwise, the operation simply disenchants
3429 * them, godly power negating the magic. Ok, the explanation
3430 * is silly, but otherwise priests would always bless every
3431 * artifact weapon they find. Ego weapons and normal weapons
3432 * can be blessed automatically.
3434 if (have_flag(flgs, TR_BLESSED))
3437 msg_format("%s ¤Ï´û¤Ë½ËÊ¡¤µ¤ì¤Æ¤¤¤ë¡£",
3440 msg_format("%s %s %s blessed already.",
3441 ((item >= 0) ? "Your" : "The"), o_name,
3442 ((o_ptr->number > 1) ? "were" : "was"));
3448 if (!(object_is_artifact(o_ptr) || object_is_ego(o_ptr)) || one_in_(3))
3452 msg_format("%s¤Ïµ±¤¤¤¿¡ª",
3455 msg_format("%s %s shine%s!",
3456 ((item >= 0) ? "Your" : "The"), o_name,
3457 ((o_ptr->number > 1) ? "" : "s"));
3460 add_flag(o_ptr->art_flags, TR_BLESSED);
3461 o_ptr->discount = 99;
3465 bool dis_happened = FALSE;
3468 msg_print("¤½¤ÎÉð´ï¤Ï½ËÊ¡¤ò·ù¤Ã¤Æ¤¤¤ë¡ª");
3470 msg_print("The weapon resists your blessing!");
3474 /* Disenchant tohit */
3475 if (o_ptr->to_h > 0)
3478 dis_happened = TRUE;
3481 if ((o_ptr->to_h > 5) && (randint0(100) < 33)) o_ptr->to_h--;
3483 /* Disenchant todam */
3484 if (o_ptr->to_d > 0)
3487 dis_happened = TRUE;
3490 if ((o_ptr->to_d > 5) && (randint0(100) < 33)) o_ptr->to_d--;
3492 /* Disenchant toac */
3493 if (o_ptr->to_a > 0)
3496 dis_happened = TRUE;
3499 if ((o_ptr->to_a > 5) && (randint0(100) < 33)) o_ptr->to_a--;
3504 msg_print("¼þ°Ï¤¬ËÞÍǤÊÊ·°Ïµ¤¤ÇËþ¤Á¤¿...");
3506 msg_print("There is a static feeling in the air...");
3510 msg_format("%s ¤ÏÎô²½¤·¤¿¡ª",
3513 msg_format("%s %s %s disenchanted!",
3514 ((item >= 0) ? "Your" : "The"), o_name,
3515 ((o_ptr->number > 1) ? "were" : "was"));
3521 /* Recalculate bonuses */
3522 p_ptr->update |= (PU_BONUS);
3525 p_ptr->window |= (PW_EQUIP | PW_PLAYER);
3536 bool pulish_shield(void)
3540 u32b flgs[TR_FLAG_SIZE];
3541 char o_name[MAX_NLEN];
3544 item_tester_no_ryoute = TRUE;
3545 /* Assume enchant weapon */
3546 item_tester_tval = TV_SHIELD;
3550 q = "¤É¤Î½â¤òËᤤޤ¹¤«¡©";
3551 s = "Ë᤯½â¤¬¤¢¤ê¤Þ¤»¤ó¡£";
3553 q = "Pulish which weapon? ";
3554 s = "You have weapon to pulish.";
3557 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR)))
3560 /* Get the item (in the pack) */
3563 o_ptr = &inventory[item];
3566 /* Get the item (on the floor) */
3569 o_ptr = &o_list[0 - item];
3574 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
3576 /* Extract the flags */
3577 object_flags(o_ptr, flgs);
3579 if (o_ptr->k_idx && !object_is_artifact(o_ptr) && !object_is_ego(o_ptr) &&
3580 !object_is_cursed(o_ptr) && (o_ptr->sval != SV_MIRROR_SHIELD))
3583 msg_format("%s¤Ïµ±¤¤¤¿¡ª", o_name);
3585 msg_format("%s %s shine%s!",
3586 ((item >= 0) ? "Your" : "The"), o_name,
3587 ((o_ptr->number > 1) ? "" : "s"));
3589 o_ptr->name2 = EGO_REFLECTION;
3590 enchant(o_ptr, randint0(3) + 4, ENCH_TOAC);
3592 o_ptr->discount = 99;
3593 chg_virtue(V_ENCHANT, 2);
3599 if (flush_failure) flush();
3602 msg_print("¼ºÇÔ¤·¤¿¡£");
3604 msg_print("Failed.");
3607 chg_virtue(V_ENCHANT, -2);
3616 * Potions "smash open" and cause an area effect when
3617 * (1) they are shattered while in the player's inventory,
3618 * due to cold (etc) attacks;
3619 * (2) they are thrown at a monster, or obstacle;
3620 * (3) they are shattered by a "cold ball" or other such spell
3621 * while lying on the floor.
3624 * who --- who caused the potion to shatter (0=player)
3625 * potions that smash on the floor are assumed to
3626 * be caused by no-one (who = 1), as are those that
3627 * shatter inside the player inventory.
3628 * (Not anymore -- I changed this; TY)
3629 * y, x --- coordinates of the potion (or player if
3630 * the potion was in her inventory);
3631 * o_ptr --- pointer to the potion object.
3633 bool potion_smash_effect(int who, int y, int x, int k_idx)
3640 object_kind *k_ptr = &k_info[k_idx];
3642 switch (k_ptr->sval)
3644 case SV_POTION_SALT_WATER:
3645 case SV_POTION_SLIME_MOLD:
3646 case SV_POTION_LOSE_MEMORIES:
3647 case SV_POTION_DEC_STR:
3648 case SV_POTION_DEC_INT:
3649 case SV_POTION_DEC_WIS:
3650 case SV_POTION_DEC_DEX:
3651 case SV_POTION_DEC_CON:
3652 case SV_POTION_DEC_CHR:
3653 case SV_POTION_WATER: /* perhaps a 'water' attack? */
3654 case SV_POTION_APPLE_JUICE:
3657 case SV_POTION_INFRAVISION:
3658 case SV_POTION_DETECT_INVIS:
3659 case SV_POTION_SLOW_POISON:
3660 case SV_POTION_CURE_POISON:
3661 case SV_POTION_BOLDNESS:
3662 case SV_POTION_RESIST_HEAT:
3663 case SV_POTION_RESIST_COLD:
3664 case SV_POTION_HEROISM:
3665 case SV_POTION_BESERK_STRENGTH:
3666 case SV_POTION_RES_STR:
3667 case SV_POTION_RES_INT:
3668 case SV_POTION_RES_WIS:
3669 case SV_POTION_RES_DEX:
3670 case SV_POTION_RES_CON:
3671 case SV_POTION_RES_CHR:
3672 case SV_POTION_INC_STR:
3673 case SV_POTION_INC_INT:
3674 case SV_POTION_INC_WIS:
3675 case SV_POTION_INC_DEX:
3676 case SV_POTION_INC_CON:
3677 case SV_POTION_INC_CHR:
3678 case SV_POTION_AUGMENTATION:
3679 case SV_POTION_ENLIGHTENMENT:
3680 case SV_POTION_STAR_ENLIGHTENMENT:
3681 case SV_POTION_SELF_KNOWLEDGE:
3682 case SV_POTION_EXPERIENCE:
3683 case SV_POTION_RESISTANCE:
3684 case SV_POTION_INVULNERABILITY:
3685 case SV_POTION_NEW_LIFE:
3686 /* All of the above potions have no effect when shattered */
3688 case SV_POTION_SLOWNESS:
3693 case SV_POTION_POISON:
3698 case SV_POTION_BLINDNESS:
3702 case SV_POTION_CONFUSION: /* Booze */
3706 case SV_POTION_SLEEP:
3710 case SV_POTION_RUINATION:
3711 case SV_POTION_DETONATIONS:
3713 dam = damroll(25, 25);
3716 case SV_POTION_DEATH:
3717 dt = GF_DEATH_RAY; /* !! */
3718 dam = k_ptr->level * 10;
3722 case SV_POTION_SPEED:
3725 case SV_POTION_CURE_LIGHT:
3727 dam = damroll(2, 3);
3729 case SV_POTION_CURE_SERIOUS:
3731 dam = damroll(4, 3);
3733 case SV_POTION_CURE_CRITICAL:
3734 case SV_POTION_CURING:
3736 dam = damroll(6, 3);
3738 case SV_POTION_HEALING:
3740 dam = damroll(10, 10);
3742 case SV_POTION_RESTORE_EXP:
3747 case SV_POTION_LIFE:
3749 dam = damroll(50, 50);
3752 case SV_POTION_STAR_HEALING:
3754 dam = damroll(50, 50);
3757 case SV_POTION_RESTORE_MANA: /* MANA */
3759 dam = damroll(10, 10);
3766 (void)project(who, radius, y, x, dam, dt,
3767 (PROJECT_JUMP | PROJECT_ITEM | PROJECT_KILL), -1);
3769 /* XXX those potions that explode need to become "known" */
3775 * Hack -- Display all known spells in a window
3777 * XXX XXX XXX Need to analyze size of the window.
3779 * XXX XXX XXX Need more color coding.
3781 void display_spell_list(void)
3794 /* They have too many spells to list */
3795 if (p_ptr->pclass == CLASS_SORCERER) return;
3796 if (p_ptr->pclass == CLASS_RED_MAGE) return;
3798 /* mind.c type classes */
3799 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
3800 (p_ptr->pclass == CLASS_BERSERKER) ||
3801 (p_ptr->pclass == CLASS_NINJA) ||
3802 (p_ptr->pclass == CLASS_MIRROR_MASTER) ||
3803 (p_ptr->pclass == CLASS_FORCETRAINER))
3809 int plev = p_ptr->lev;
3815 bool use_hp = FALSE;
3817 /* Display a list of spells */
3820 put_str("̾Á°", y, x + 5);
3821 put_str("Lv MP ¼ºÎ¨ ¸ú²Ì", y, x + 35);
3823 put_str("Name", y, x + 5);
3824 put_str("Lv Mana Fail Info", y, x + 35);
3827 switch(p_ptr->pclass)
3829 case CLASS_MINDCRAFTER: use_mind = MIND_MINDCRAFTER;break;
3830 case CLASS_FORCETRAINER: use_mind = MIND_KI;break;
3831 case CLASS_BERSERKER: use_mind = MIND_BERSERKER; use_hp = TRUE; break;
3832 case CLASS_MIRROR_MASTER: use_mind = MIND_MIRROR_MASTER; break;
3833 case CLASS_NINJA: use_mind = MIND_NINJUTSU; use_hp = TRUE; break;
3834 default: use_mind = 0;break;
3837 /* Dump the spells */
3838 for (i = 0; i < MAX_MIND_POWERS; i++)
3840 byte a = TERM_WHITE;
3842 /* Access the available spell */
3843 spell = mind_powers[use_mind].info[i];
3844 if (spell.min_lev > plev) break;
3846 /* Get the failure rate */
3847 chance = spell.fail;
3849 /* Reduce failure rate by "effective" level adjustment */
3850 chance -= 3 * (p_ptr->lev - spell.min_lev);
3852 /* Reduce failure rate by INT/WIS adjustment */
3853 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
3857 /* Not enough mana to cast */
3858 if (spell.mana_cost > p_ptr->csp)
3860 chance += 5 * (spell.mana_cost - p_ptr->csp);
3866 /* Not enough hp to cast */
3867 if (spell.mana_cost > p_ptr->chp)
3874 /* Extract the minimum failure rate */
3875 minfail = adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]];
3877 /* Minimum failure rate */
3878 if (chance < minfail) chance = minfail;
3880 /* Stunning makes spells harder */
3881 if (p_ptr->stun > 50) chance += 25;
3882 else if (p_ptr->stun) chance += 15;
3884 /* Always a 5 percent chance of working */
3885 if (chance > 95) chance = 95;
3888 mindcraft_info(comment, use_mind, i);
3890 /* Dump the spell */
3891 sprintf(psi_desc, " %c) %-30s%2d %4d %3d%%%s",
3893 spell.min_lev, spell.mana_cost, chance, comment);
3895 Term_putstr(x, y + i + 1, -1, a, psi_desc);
3900 /* Cannot read spellbooks */
3901 if (REALM_NONE == p_ptr->realm1) return;
3903 /* Normal spellcaster with books */
3906 for (j = 0; j < ((p_ptr->realm2 > REALM_NONE) ? 2 : 1); j++)
3910 /* Reset vertical */
3913 /* Vertical location */
3914 y = (j < 3) ? 0 : (m[j - 3] + 2);
3916 /* Horizontal location */
3920 for (i = 0; i < 32; i++)
3922 byte a = TERM_WHITE;
3924 /* Access the spell */
3925 if (!is_magic((j < 1) ? p_ptr->realm1 : p_ptr->realm2))
3927 s_ptr = &technic_info[((j < 1) ? p_ptr->realm1 : p_ptr->realm2) - MIN_TECHNIC][i % 32];
3931 s_ptr = &mp_ptr->info[((j < 1) ? p_ptr->realm1 : p_ptr->realm2) - 1][i % 32];
3934 strcpy(name, do_spell((j < 1) ? p_ptr->realm1 : p_ptr->realm2, i % 32, SPELL_NAME));
3937 if (s_ptr->slevel >= 99)
3941 strcpy(name, "(ȽÆÉÉÔǽ)");
3943 strcpy(name, "(illegible)");
3953 ((p_ptr->spell_forgotten1 & (1L << i))) :
3954 ((p_ptr->spell_forgotten2 & (1L << (i % 32)))))
3961 else if (!((j < 1) ?
3962 (p_ptr->spell_learned1 & (1L << i)) :
3963 (p_ptr->spell_learned2 & (1L << (i % 32)))))
3970 else if (!((j < 1) ?
3971 (p_ptr->spell_worked1 & (1L << i)) :
3972 (p_ptr->spell_worked2 & (1L << (i % 32)))))
3978 /* Dump the spell --(-- */
3979 sprintf(out_val, "%c/%c) %-20.20s",
3980 I2A(n / 8), I2A(n % 8), name);
3985 /* Dump onto the window */
3986 Term_putstr(x, m[j], -1, a, out_val);
3996 * Returns experience of a spell
3998 s16b experience_of_spell(int spell, int use_realm)
4000 if (p_ptr->pclass == CLASS_SORCERER) return SPELL_EXP_MASTER;
4001 else if (p_ptr->pclass == CLASS_RED_MAGE) return SPELL_EXP_SKILLED;
4002 else if (use_realm == p_ptr->realm1) return p_ptr->spell_exp[spell];
4003 else if (use_realm == p_ptr->realm2) return p_ptr->spell_exp[spell + 32];
4009 * Modify mana consumption rate using spell exp and p_ptr->dec_mana
4011 int mod_need_mana(int need_mana, int spell, int realm)
4013 #define MANA_CONST 2400
4015 #define DEC_MANA_DIV 3
4018 if ((realm > REALM_NONE) && (realm <= MAX_REALM))
4021 * need_mana defaults if spell exp equals SPELL_EXP_EXPERT and !p_ptr->dec_mana.
4022 * MANA_CONST is used to calculate need_mana effected from spell proficiency.
4024 need_mana = need_mana * (MANA_CONST + SPELL_EXP_EXPERT - experience_of_spell(spell, realm)) + (MANA_CONST - 1);
4025 need_mana *= p_ptr->dec_mana ? DEC_MANA_DIV : MANA_DIV;
4026 need_mana /= MANA_CONST * MANA_DIV;
4027 if (need_mana < 1) need_mana = 1;
4030 /* Non-realm magic */
4033 if (p_ptr->dec_mana) need_mana = (need_mana + 1) * DEC_MANA_DIV / MANA_DIV;
4045 * Modify spell fail rate
4046 * Using p_ptr->to_m_chance, p_ptr->dec_mana, p_ptr->easy_spell and p_ptr->heavy_spell
4048 int mod_spell_chance_1(int chance)
4050 chance += p_ptr->to_m_chance;
4052 if (p_ptr->heavy_spell) chance += 20;
4054 if (p_ptr->dec_mana && p_ptr->easy_spell) chance -= 4;
4055 else if (p_ptr->easy_spell) chance -= 3;
4056 else if (p_ptr->dec_mana) chance -= 2;
4063 * Modify spell fail rate (as "suffix" process)
4064 * Using p_ptr->dec_mana, p_ptr->easy_spell and p_ptr->heavy_spell
4065 * Note: variable "chance" cannot be negative.
4067 int mod_spell_chance_2(int chance)
4069 if (p_ptr->dec_mana) chance--;
4071 if (p_ptr->heavy_spell) chance += 5;
4073 return MAX(chance, 0);
4078 * Returns spell chance of failure for spell -RAK-
4080 s16b spell_chance(int spell, int use_realm)
4082 int chance, minfail;
4085 int penalty = (mp_ptr->spell_stat == A_WIS) ? 10 : 4;
4088 /* Paranoia -- must be literate */
4089 if (!mp_ptr->spell_book) return (100);
4091 if (use_realm == REALM_HISSATSU) return 0;
4093 /* Access the spell */
4094 if (!is_magic(use_realm))
4096 s_ptr = &technic_info[use_realm - MIN_TECHNIC][spell];
4100 s_ptr = &mp_ptr->info[use_realm - 1][spell];
4103 /* Extract the base spell failure rate */
4104 chance = s_ptr->sfail;
4106 /* Reduce failure rate by "effective" level adjustment */
4107 chance -= 3 * (p_ptr->lev - s_ptr->slevel);
4109 /* Reduce failure rate by INT/WIS adjustment */
4110 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
4113 chance += (MAX(r_info[m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 100 - 10, 0));
4115 /* Extract mana consumption rate */
4116 need_mana = mod_need_mana(s_ptr->smana, spell, use_realm);
4118 /* Not enough mana to cast */
4119 if (need_mana > p_ptr->csp)
4121 chance += 5 * (need_mana - p_ptr->csp);
4124 if ((use_realm != p_ptr->realm1) && ((p_ptr->pclass == CLASS_MAGE) || (p_ptr->pclass == CLASS_PRIEST))) chance += 5;
4126 /* Extract the minimum failure rate */
4127 minfail = adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]];
4130 * Non mage/priest characters never get too good
4131 * (added high mage, mindcrafter)
4133 if (mp_ptr->spell_xtra & MAGIC_FAIL_5PERCENT)
4135 if (minfail < 5) minfail = 5;
4138 /* Hack -- Priest prayer penalty for "edged" weapons -DGK */
4139 if (((p_ptr->pclass == CLASS_PRIEST) || (p_ptr->pclass == CLASS_SORCERER)) && p_ptr->icky_wield[0]) chance += 25;
4140 if (((p_ptr->pclass == CLASS_PRIEST) || (p_ptr->pclass == CLASS_SORCERER)) && p_ptr->icky_wield[1]) chance += 25;
4142 chance = mod_spell_chance_1(chance);
4144 if ((use_realm == REALM_NATURE) && ((p_ptr->align > 50) || (p_ptr->align < -50))) chance += penalty;
4145 if (((use_realm == REALM_LIFE) || (use_realm == REALM_CRUSADE)) && (p_ptr->align < -20)) chance += penalty;
4146 if (((use_realm == REALM_DEATH) || (use_realm == REALM_DAEMON)) && (p_ptr->align > 20)) chance += penalty;
4148 /* Minimum failure rate */
4149 if (chance < minfail) chance = minfail;
4151 /* Stunning makes spells harder */
4152 if (p_ptr->stun > 50) chance += 25;
4153 else if (p_ptr->stun) chance += 15;
4155 /* Always a 5 percent chance of working */
4156 if (chance > 95) chance = 95;
4158 if ((use_realm == p_ptr->realm1) || (use_realm == p_ptr->realm2)
4159 || (p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4161 s16b exp = experience_of_spell(spell, use_realm);
4162 if (exp >= SPELL_EXP_EXPERT) chance--;
4163 if (exp >= SPELL_EXP_MASTER) chance--;
4166 /* Return the chance */
4167 return mod_spell_chance_2(chance);
4173 * Determine if a spell is "okay" for the player to cast or study
4174 * The spell must be legible, not forgotten, and also, to cast,
4175 * it must be known, and to study, it must not be known.
4177 bool spell_okay(int spell, bool learned, bool study_pray, int use_realm)
4181 /* Access the spell */
4182 if (!is_magic(use_realm))
4184 s_ptr = &technic_info[use_realm - MIN_TECHNIC][spell];
4188 s_ptr = &mp_ptr->info[use_realm - 1][spell];
4191 /* Spell is illegal */
4192 if (s_ptr->slevel > p_ptr->lev) return (FALSE);
4194 /* Spell is forgotten */
4195 if ((use_realm == p_ptr->realm2) ?
4196 (p_ptr->spell_forgotten2 & (1L << spell)) :
4197 (p_ptr->spell_forgotten1 & (1L << spell)))
4203 if (p_ptr->pclass == CLASS_SORCERER) return (TRUE);
4204 if (p_ptr->pclass == CLASS_RED_MAGE) return (TRUE);
4206 /* Spell is learned */
4207 if ((use_realm == p_ptr->realm2) ?
4208 (p_ptr->spell_learned2 & (1L << spell)) :
4209 (p_ptr->spell_learned1 & (1L << spell)))
4212 return (!study_pray);
4215 /* Okay to study, not to cast */
4221 * Print a list of spells (for browsing or casting or viewing)
4223 void print_spells(int target_spell, byte *spells, int num, int y, int x, int use_realm)
4225 int i, spell, exp_level, increment = 64;
4237 if (((use_realm <= REALM_NONE) || (use_realm > MAX_REALM)) && p_ptr->wizard)
4239 msg_print("·Ù¹ð¡ª print_spell ¤¬Îΰè¤Ê¤·¤Ë¸Æ¤Ð¤ì¤¿");
4241 msg_print("Warning! print_spells called with null realm");
4245 /* Title the list */
4247 if (use_realm == REALM_HISSATSU)
4249 strcpy(buf," Lv MP");
4251 strcpy(buf," Lv SP");
4255 strcpy(buf,"½ÏÎýÅÙ Lv MP ¼ºÎ¨ ¸ú²Ì");
4257 strcpy(buf,"Profic Lv SP Fail Effect");
4261 put_str("̾Á°", y, x + 5);
4262 put_str(buf, y, x + 29);
4264 put_str("Name", y, x + 5);
4265 put_str(buf, y, x + 29);
4268 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE)) increment = 0;
4269 else if (use_realm == p_ptr->realm1) increment = 0;
4270 else if (use_realm == p_ptr->realm2) increment = 32;
4272 /* Dump the spells */
4273 for (i = 0; i < num; i++)
4275 /* Access the spell */
4278 /* Access the spell */
4279 if (!is_magic(use_realm))
4281 s_ptr = &technic_info[use_realm - MIN_TECHNIC][spell];
4285 s_ptr = &mp_ptr->info[use_realm - 1][spell];
4288 if (use_realm == REALM_HISSATSU)
4289 need_mana = s_ptr->smana;
4292 s16b exp = experience_of_spell(spell, use_realm);
4294 /* Extract mana consumption rate */
4295 need_mana = mod_need_mana(s_ptr->smana, spell, use_realm);
4297 if ((increment == 64) || (s_ptr->slevel >= 99)) exp_level = EXP_LEVEL_UNSKILLED;
4298 else exp_level = spell_exp_level(exp);
4301 if (!increment && (exp_level == EXP_LEVEL_MASTER)) max = TRUE;
4302 else if ((increment == 32) && (exp_level >= EXP_LEVEL_EXPERT)) max = TRUE;
4303 else if (s_ptr->slevel >= 99) max = TRUE;
4304 else if ((p_ptr->pclass == CLASS_RED_MAGE) && (exp_level >= EXP_LEVEL_SKILLED)) max = TRUE;
4306 strncpy(ryakuji, exp_level_str[exp_level], 4);
4311 if (use_menu && target_spell)
4313 if (i == (target_spell-1))
4315 strcpy(out_val, " ¡Õ ");
4317 strcpy(out_val, " > ");
4320 strcpy(out_val, " ");
4322 else sprintf(out_val, " %c) ", I2A(i));
4323 /* Skip illegible spells */
4324 if (s_ptr->slevel >= 99)
4327 strcat(out_val, format("%-30s", "(ȽÆÉÉÔǽ)"));
4329 strcat(out_val, format("%-30s", "(illegible)"));
4332 c_prt(TERM_L_DARK, out_val, y + i + 1, x);
4336 /* XXX XXX Could label spells above the players level */
4338 /* Get extra info */
4339 strcpy(info, do_spell(use_realm, spell, SPELL_INFO));
4344 /* Assume spell is known and tried */
4345 line_attr = TERM_WHITE;
4347 /* Analyze the spell */
4348 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4350 if (s_ptr->slevel > p_ptr->max_plv)
4355 comment = "unknown";
4358 line_attr = TERM_L_BLUE;
4360 else if (s_ptr->slevel > p_ptr->lev)
4365 comment = "forgotten";
4368 line_attr = TERM_YELLOW;
4371 else if ((use_realm != p_ptr->realm1) && (use_realm != p_ptr->realm2))
4376 comment = "unknown";
4379 line_attr = TERM_L_BLUE;
4381 else if ((use_realm == p_ptr->realm1) ?
4382 ((p_ptr->spell_forgotten1 & (1L << spell))) :
4383 ((p_ptr->spell_forgotten2 & (1L << spell))))
4388 comment = "forgotten";
4391 line_attr = TERM_YELLOW;
4393 else if (!((use_realm == p_ptr->realm1) ?
4394 (p_ptr->spell_learned1 & (1L << spell)) :
4395 (p_ptr->spell_learned2 & (1L << spell))))
4400 comment = "unknown";
4403 line_attr = TERM_L_BLUE;
4405 else if (!((use_realm == p_ptr->realm1) ?
4406 (p_ptr->spell_worked1 & (1L << spell)) :
4407 (p_ptr->spell_worked2 & (1L << spell))))
4412 comment = "untried";
4415 line_attr = TERM_L_GREEN;
4418 /* Dump the spell --(-- */
4419 if (use_realm == REALM_HISSATSU)
4421 strcat(out_val, format("%-25s %2d %4d",
4422 do_spell(use_realm, spell, SPELL_NAME), /* realm, spell */
4423 s_ptr->slevel, need_mana));
4427 strcat(out_val, format("%-25s%c%-4s %2d %4d %3d%% %s",
4428 do_spell(use_realm, spell, SPELL_NAME), /* realm, spell */
4429 (max ? '!' : ' '), ryakuji,
4430 s_ptr->slevel, need_mana, spell_chance(spell, use_realm), comment));
4432 c_prt(line_attr, out_val, y + i + 1, x);
4435 /* Clear the bottom line */
4436 prt("", y + i + 1, x);
4441 * Note that amulets, rods, and high-level spell books are immune
4442 * to "inventory damage" of any kind. Also sling ammo and shovels.
4447 * Does a given class of objects (usually) hate acid?
4448 * Note that acid can either melt or corrode something.
4450 bool hates_acid(object_type *o_ptr)
4452 /* Analyze the type */
4453 switch (o_ptr->tval)
4455 /* Wearable items */
4475 /* Staffs/Scrolls are wood/paper */
4488 /* Junk is useless */
4502 * Does a given object (usually) hate electricity?
4504 bool hates_elec(object_type *o_ptr)
4506 switch (o_ptr->tval)
4520 * Does a given object (usually) hate fire?
4521 * Hafted/Polearm weapons have wooden shafts.
4522 * Arrows/Bows are mostly wooden.
4524 bool hates_fire(object_type *o_ptr)
4526 /* Analyze the type */
4527 switch (o_ptr->tval)
4545 case TV_SORCERY_BOOK:
4546 case TV_NATURE_BOOK:
4550 case TV_ARCANE_BOOK:
4552 case TV_DAEMON_BOOK:
4553 case TV_CRUSADE_BOOK:
4555 case TV_HISSATSU_BOOK:
4566 /* Staffs/Scrolls burn */
4579 * Does a given object (usually) hate cold?
4581 bool hates_cold(object_type *o_ptr)
4583 switch (o_ptr->tval)
4600 int set_acid_destroy(object_type *o_ptr)
4602 u32b flgs[TR_FLAG_SIZE];
4603 if (!hates_acid(o_ptr)) return (FALSE);
4604 object_flags(o_ptr, flgs);
4605 if (have_flag(flgs, TR_IGNORE_ACID)) return (FALSE);
4613 int set_elec_destroy(object_type *o_ptr)
4615 u32b flgs[TR_FLAG_SIZE];
4616 if (!hates_elec(o_ptr)) return (FALSE);
4617 object_flags(o_ptr, flgs);
4618 if (have_flag(flgs, TR_IGNORE_ELEC)) return (FALSE);
4626 int set_fire_destroy(object_type *o_ptr)
4628 u32b flgs[TR_FLAG_SIZE];
4629 if (!hates_fire(o_ptr)) return (FALSE);
4630 object_flags(o_ptr, flgs);
4631 if (have_flag(flgs, TR_IGNORE_FIRE)) return (FALSE);
4639 int set_cold_destroy(object_type *o_ptr)
4641 u32b flgs[TR_FLAG_SIZE];
4642 if (!hates_cold(o_ptr)) return (FALSE);
4643 object_flags(o_ptr, flgs);
4644 if (have_flag(flgs, TR_IGNORE_COLD)) return (FALSE);
4650 * Destroys a type of item on a given percent chance
4651 * Note that missiles are no longer necessarily all destroyed
4652 * Destruction taken from "melee.c" code for "stealing".
4653 * New-style wands and rods handled correctly. -LM-
4654 * Returns number of items destroyed.
4656 int inven_damage(inven_func typ, int perc)
4660 char o_name[MAX_NLEN];
4662 /* Multishadow effects is determined by turn */
4663 if( p_ptr->multishadow && (turn & 1) )return 0;
4665 if (p_ptr->inside_arena) return 0;
4667 /* Count the casualties */
4670 /* Scan through the slots backwards */
4671 for (i = 0; i < INVEN_PACK; i++)
4673 o_ptr = &inventory[i];
4675 /* Skip non-objects */
4676 if (!o_ptr->k_idx) continue;
4678 /* Hack -- for now, skip artifacts */
4679 if (object_is_artifact(o_ptr)) continue;
4681 /* Give this item slot a shot at death */
4684 /* Count the casualties */
4685 for (amt = j = 0; j < o_ptr->number; ++j)
4687 if (randint0(100) < perc) amt++;
4690 /* Some casualities */
4693 /* Get a description */
4694 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
4698 msg_format("%s(%c)¤¬%s²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª",
4700 msg_format("%sour %s (%c) %s destroyed!",
4704 o_name, index_to_label(i),
4705 ((o_ptr->number > 1) ?
4706 ((amt == o_ptr->number) ? "Á´Éô" :
4707 (amt > 1 ? "²¿¸Ä¤«" : "°ì¸Ä")) : "") );
4709 ((o_ptr->number > 1) ?
4710 ((amt == o_ptr->number) ? "All of y" :
4711 (amt > 1 ? "Some of y" : "One of y")) : "Y"),
4712 o_name, index_to_label(i),
4713 ((amt > 1) ? "were" : "was"));
4717 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
4718 msg_print("¤ä¤ê¤ä¤¬¤Ã¤¿¤Ê¡ª");
4721 /* Potions smash open */
4722 if (object_is_potion(o_ptr))
4724 (void)potion_smash_effect(0, py, px, o_ptr->k_idx);
4727 /* Reduce the charges of rods/wands */
4728 reduce_charges(o_ptr, amt);
4730 /* Destroy "amt" items */
4731 inven_item_increase(i, -amt);
4732 inven_item_optimize(i);
4734 /* Count the casualties */
4740 /* Return the casualty count */
4746 * Acid has hit the player, attempt to affect some armor.
4748 * Note that the "base armor" of an object never changes.
4750 * If any armor is damaged (or resists), the player takes less damage.
4752 static int minus_ac(void)
4754 object_type *o_ptr = NULL;
4755 u32b flgs[TR_FLAG_SIZE];
4756 char o_name[MAX_NLEN];
4759 /* Pick a (possibly empty) inventory slot */
4760 switch (randint1(7))
4762 case 1: o_ptr = &inventory[INVEN_RARM]; break;
4763 case 2: o_ptr = &inventory[INVEN_LARM]; break;
4764 case 3: o_ptr = &inventory[INVEN_BODY]; break;
4765 case 4: o_ptr = &inventory[INVEN_OUTER]; break;
4766 case 5: o_ptr = &inventory[INVEN_HANDS]; break;
4767 case 6: o_ptr = &inventory[INVEN_HEAD]; break;
4768 case 7: o_ptr = &inventory[INVEN_FEET]; break;
4771 /* Nothing to damage */
4772 if (!o_ptr->k_idx) return (FALSE);
4774 if (!object_is_armour(o_ptr)) return (FALSE);
4776 /* No damage left to be done */
4777 if (o_ptr->ac + o_ptr->to_a <= 0) return (FALSE);
4781 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
4783 /* Extract the flags */
4784 object_flags(o_ptr, flgs);
4786 /* Object resists */
4787 if (have_flag(flgs, TR_IGNORE_ACID))
4790 msg_format("¤·¤«¤·%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª", o_name);
4792 msg_format("Your %s is unaffected!", o_name);
4801 msg_format("%s¤¬¥À¥á¡¼¥¸¤ò¼õ¤±¤¿¡ª", o_name);
4803 msg_format("Your %s is damaged!", o_name);
4807 /* Damage the item */
4810 /* Calculate bonuses */
4811 p_ptr->update |= (PU_BONUS);
4814 p_ptr->window |= (PW_EQUIP | PW_PLAYER);
4818 /* Item was damaged */
4824 * Hurt the player with Acid
4826 int acid_dam(int dam, cptr kb_str, int monspell)
4829 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
4830 bool double_resist = IS_OPPOSE_ACID();
4832 /* Total Immunity */
4833 if (p_ptr->immune_acid || (dam <= 0))
4835 learn_spell(monspell);
4839 /* Vulnerability (Ouch!) */
4840 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
4841 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
4843 /* Resist the damage */
4844 if (p_ptr->resist_acid) dam = (dam + 2) / 3;
4845 if (double_resist) dam = (dam + 2) / 3;
4847 if ((!(double_resist || p_ptr->resist_acid)) &&
4848 one_in_(HURT_CHANCE))
4849 (void)do_dec_stat(A_CHR);
4851 /* If any armor gets hit, defend the player */
4852 if (minus_ac()) dam = (dam + 1) / 2;
4855 get_damage=take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
4857 /* Inventory damage */
4858 if (!(double_resist && p_ptr->resist_acid))
4859 inven_damage(set_acid_destroy, inv);
4865 * Hurt the player with electricity
4867 int elec_dam(int dam, cptr kb_str, int monspell)
4870 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
4871 bool double_resist = IS_OPPOSE_ELEC();
4873 /* Total immunity */
4874 if (p_ptr->immune_elec || (dam <= 0))
4876 learn_spell(monspell);
4880 /* Vulnerability (Ouch!) */
4881 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
4882 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
4883 if (prace_is_(RACE_ANDROID)) dam += dam / 3;
4885 /* Resist the damage */
4886 if (p_ptr->resist_elec) dam = (dam + 2) / 3;
4887 if (double_resist) dam = (dam + 2) / 3;
4889 if ((!(double_resist || p_ptr->resist_elec)) &&
4890 one_in_(HURT_CHANCE))
4891 (void)do_dec_stat(A_DEX);
4894 get_damage=take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
4896 /* Inventory damage */
4897 if (!(double_resist && p_ptr->resist_elec))
4898 inven_damage(set_elec_destroy, inv);
4905 * Hurt the player with Fire
4907 int fire_dam(int dam, cptr kb_str, int monspell)
4910 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
4911 bool double_resist = IS_OPPOSE_FIRE();
4913 /* Totally immune */
4914 if (p_ptr->immune_fire || (dam <= 0))
4916 learn_spell(monspell);
4920 /* Vulnerability (Ouch!) */
4921 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
4922 if (prace_is_(RACE_ENT)) dam += dam / 3;
4923 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
4925 /* Resist the damage */
4926 if (p_ptr->resist_fire) dam = (dam + 2) / 3;
4927 if (double_resist) dam = (dam + 2) / 3;
4929 if ((!(double_resist || p_ptr->resist_fire)) &&
4930 one_in_(HURT_CHANCE))
4931 (void)do_dec_stat(A_STR);
4934 get_damage=take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
4936 /* Inventory damage */
4937 if (!(double_resist && p_ptr->resist_fire))
4938 inven_damage(set_fire_destroy, inv);
4945 * Hurt the player with Cold
4947 int cold_dam(int dam, cptr kb_str, int monspell)
4950 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
4951 bool double_resist = IS_OPPOSE_COLD();
4953 /* Total immunity */
4954 if (p_ptr->immune_cold || (dam <= 0))
4956 learn_spell(monspell);
4960 /* Vulnerability (Ouch!) */
4961 if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
4962 if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
4964 /* Resist the damage */
4965 if (p_ptr->resist_cold) dam = (dam + 2) / 3;
4966 if (double_resist) dam = (dam + 2) / 3;
4968 if ((!(double_resist || p_ptr->resist_cold)) &&
4969 one_in_(HURT_CHANCE))
4970 (void)do_dec_stat(A_STR);
4973 get_damage=take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
4975 /* Inventory damage */
4976 if (!(double_resist && p_ptr->resist_cold))
4977 inven_damage(set_cold_destroy, inv);
4983 bool rustproof(void)
4987 char o_name[MAX_NLEN];
4990 item_tester_no_ryoute = TRUE;
4991 /* Select a piece of armour */
4992 item_tester_hook = object_is_armour;
4996 q = "¤É¤ÎËɶñ¤Ë»¬»ß¤á¤ò¤·¤Þ¤¹¤«¡©";
4997 s = "»¬»ß¤á¤Ç¤¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
4999 q = "Rustproof which piece of armour? ";
5000 s = "You have nothing to rustproof.";
5003 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return FALSE;
5005 /* Get the item (in the pack) */
5008 o_ptr = &inventory[item];
5011 /* Get the item (on the floor) */
5014 o_ptr = &o_list[0 - item];
5019 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
5021 add_flag(o_ptr->art_flags, TR_IGNORE_ACID);
5023 if ((o_ptr->to_a < 0) && !object_is_cursed(o_ptr))
5026 msg_format("%s¤Ï¿·ÉÊƱÍͤˤʤä¿¡ª",o_name);
5028 msg_format("%s %s look%s as good as new!",
5029 ((item >= 0) ? "Your" : "The"), o_name,
5030 ((o_ptr->number > 1) ? "" : "s"));
5037 msg_format("%s¤ÏÉå¿©¤·¤Ê¤¯¤Ê¤Ã¤¿¡£", o_name);
5039 msg_format("%s %s %s now protected against corrosion.",
5040 ((item >= 0) ? "Your" : "The"), o_name,
5041 ((o_ptr->number > 1) ? "are" : "is"));
5052 * Curse the players armor
5054 bool curse_armor(void)
5059 char o_name[MAX_NLEN];
5062 /* Curse the body armor */
5063 o_ptr = &inventory[INVEN_BODY];
5065 /* Nothing to curse */
5066 if (!o_ptr->k_idx) return (FALSE);
5070 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
5072 /* Attempt a saving throw for artifacts */
5073 if (object_is_artifact(o_ptr) && (randint0(100) < 50))
5077 msg_format("%s¤¬%s¤òÊñ¤ß¹þ¤â¤¦¤È¤·¤¿¤¬¡¢%s¤Ï¤½¤ì¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
5078 "¶²ÉݤΰŹõ¥ª¡¼¥é", "Ëɶñ", o_name);
5080 msg_format("A %s tries to %s, but your %s resists the effects!",
5081 "terrible black aura", "surround your armor", o_name);
5086 /* not artifact or failed save... */
5091 msg_format("¶²ÉݤΰŹõ¥ª¡¼¥é¤¬¤¢¤Ê¤¿¤Î%s¤òÊñ¤ß¹þ¤ó¤À¡ª", o_name);
5093 msg_format("A terrible black aura blasts your %s!", o_name);
5096 chg_virtue(V_ENCHANT, -5);
5098 /* Blast the armor */
5100 o_ptr->name2 = EGO_BLASTED;
5101 o_ptr->to_a = 0 - randint1(5) - randint1(5);
5108 for (i = 0; i < TR_FLAG_SIZE; i++)
5109 o_ptr->art_flags[i] = 0;
5112 o_ptr->curse_flags = TRC_CURSED;
5115 o_ptr->ident |= (IDENT_BROKEN);
5117 /* Recalculate bonuses */
5118 p_ptr->update |= (PU_BONUS);
5120 /* Recalculate mana */
5121 p_ptr->update |= (PU_MANA);
5124 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
5132 * Curse the players weapon
5134 bool curse_weapon(bool force, int slot)
5140 char o_name[MAX_NLEN];
5143 /* Curse the weapon */
5144 o_ptr = &inventory[slot];
5146 /* Nothing to curse */
5147 if (!o_ptr->k_idx) return (FALSE);
5151 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
5153 /* Attempt a saving throw */
5154 if (object_is_artifact(o_ptr) && (randint0(100) < 50) && !force)
5158 msg_format("%s¤¬%s¤òÊñ¤ß¹þ¤â¤¦¤È¤·¤¿¤¬¡¢%s¤Ï¤½¤ì¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
5159 "¶²ÉݤΰŹõ¥ª¡¼¥é", "Éð´ï", o_name);
5161 msg_format("A %s tries to %s, but your %s resists the effects!",
5162 "terrible black aura", "surround your weapon", o_name);
5167 /* not artifact or failed save... */
5172 if (!force) msg_format("¶²ÉݤΰŹõ¥ª¡¼¥é¤¬¤¢¤Ê¤¿¤Î%s¤òÊñ¤ß¹þ¤ó¤À¡ª", o_name);
5174 if (!force) msg_format("A terrible black aura blasts your %s!", o_name);
5177 chg_virtue(V_ENCHANT, -5);
5179 /* Shatter the weapon */
5181 o_ptr->name2 = EGO_SHATTERED;
5182 o_ptr->to_h = 0 - randint1(5) - randint1(5);
5183 o_ptr->to_d = 0 - randint1(5) - randint1(5);
5189 for (i = 0; i < TR_FLAG_SIZE; i++)
5190 o_ptr->art_flags[i] = 0;
5194 o_ptr->curse_flags = TRC_CURSED;
5197 o_ptr->ident |= (IDENT_BROKEN);
5199 /* Recalculate bonuses */
5200 p_ptr->update |= (PU_BONUS);
5202 /* Recalculate mana */
5203 p_ptr->update |= (PU_MANA);
5206 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
5215 * Enchant some bolts
5217 bool brand_bolts(void)
5221 /* Use the first acceptable bolts */
5222 for (i = 0; i < INVEN_PACK; i++)
5224 object_type *o_ptr = &inventory[i];
5226 /* Skip non-bolts */
5227 if (o_ptr->tval != TV_BOLT) continue;
5229 /* Skip artifacts and ego-items */
5230 if (object_is_artifact(o_ptr) || object_is_ego(o_ptr))
5233 /* Skip cursed/broken items */
5234 if (object_is_cursed(o_ptr) || object_is_broken(o_ptr)) continue;
5237 if (randint0(100) < 75) continue;
5241 msg_print("¥¯¥í¥¹¥Ü¥¦¤ÎÌ𤬱ê¤Î¥ª¡¼¥é¤ËÊñ¤Þ¤ì¤¿¡ª");
5243 msg_print("Your bolts are covered in a fiery aura!");
5248 o_ptr->name2 = EGO_FLAME;
5251 enchant(o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
5258 if (flush_failure) flush();
5262 msg_print("±ê¤Ç¶¯²½¤¹¤ë¤Î¤Ë¼ºÇÔ¤·¤¿¡£");
5264 msg_print("The fiery enchantment failed.");
5274 * Helper function -- return a "nearby" race for polymorphing
5276 * Note that this function is one of the more "dangerous" ones...
5278 static s16b poly_r_idx(int r_idx)
5280 monster_race *r_ptr = &r_info[r_idx];
5282 int i, r, lev1, lev2;
5284 /* Hack -- Uniques/Questors never polymorph */
5285 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5286 (r_ptr->flags1 & RF1_QUESTOR))
5289 /* Allowable range of "levels" for resulting monster */
5290 lev1 = r_ptr->level - ((randint1(20) / randint1(9)) + 1);
5291 lev2 = r_ptr->level + ((randint1(20) / randint1(9)) + 1);
5293 /* Pick a (possibly new) non-unique race */
5294 for (i = 0; i < 1000; i++)
5296 /* Pick a new race, using a level calculation */
5297 r = get_mon_num((dun_level + r_ptr->level) / 2 + 5);
5299 /* Handle failure */
5305 /* Ignore unique monsters */
5306 if (r_ptr->flags1 & RF1_UNIQUE) continue;
5308 /* Ignore monsters with incompatible levels */
5309 if ((r_ptr->level < lev1) || (r_ptr->level > lev2)) continue;
5311 /* Use that index */
5323 bool polymorph_monster(int y, int x)
5325 cave_type *c_ptr = &cave[y][x];
5326 monster_type *m_ptr = &m_list[c_ptr->m_idx];
5327 bool polymorphed = FALSE;
5329 int old_r_idx = m_ptr->r_idx;
5330 bool targeted = (target_who == c_ptr->m_idx) ? TRUE : FALSE;
5331 bool health_tracked = (p_ptr->health_who == c_ptr->m_idx) ? TRUE : FALSE;
5332 monster_type back_m;
5334 if (p_ptr->inside_arena || p_ptr->inside_battle) return (FALSE);
5336 if ((p_ptr->riding == c_ptr->m_idx) || (m_ptr->mflag2 & MFLAG2_KAGE)) return (FALSE);
5338 /* Memorize the monster before polymorphing */
5341 /* Pick a "new" monster race */
5342 new_r_idx = poly_r_idx(old_r_idx);
5344 /* Handle polymorph */
5345 if (new_r_idx != old_r_idx)
5349 /* Get the monsters attitude */
5350 if (is_friendly(m_ptr)) mode |= PM_FORCE_FRIENDLY;
5351 if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
5352 if (m_ptr->mflag2 & MFLAG2_NOPET) mode |= PM_NO_PET;
5354 /* "Kill" the "old" monster */
5355 delete_monster_idx(c_ptr->m_idx);
5357 /* Create a new monster (no groups) */
5358 if (place_monster_aux(0, y, x, new_r_idx, mode))
5365 /* Placing the new monster failed */
5366 if (place_monster_aux(0, y, x, old_r_idx, (mode | PM_NO_KAGE | PM_IGNORE_TERRAIN)))
5367 m_list[hack_m_idx_ii] = back_m;
5370 if (targeted) target_who = hack_m_idx_ii;
5371 if (health_tracked) health_track(hack_m_idx_ii);
5381 static bool dimension_door_aux(int x, int y)
5383 int plev = p_ptr->lev;
5385 p_ptr->energy_need += (s16b)((s32b)(60 - plev) * ENERGY_NEED() / 100L);
5387 if (!cave_player_teleportable_bold(y, x, FALSE, FALSE) ||
5388 (distance(y, x, py, px) > plev / 2 + 10) ||
5389 (!randint0(plev / 10 + 10)))
5391 p_ptr->energy_need += (s16b)((s32b)(60 - plev) * ENERGY_NEED() / 100L);
5392 teleport_player((plev + 2) * 2, TRUE);
5399 teleport_player_to(y, x, TRUE, FALSE);
5410 bool dimension_door(void)
5414 /* Rerutn FALSE if cancelled */
5415 if (!tgt_pt(&x, &y)) return FALSE;
5417 if (dimension_door_aux(x, y)) return TRUE;
5420 msg_print("ÀºÎ¤«¤éʪ¼Á³¦¤ËÌá¤ë»þ¤¦¤Þ¤¯¤¤¤«¤Ê¤«¤Ã¤¿¡ª");
5422 msg_print("You fail to exit the astral plane correctly!");
5430 * Mirror Master's Dimension Door
5432 bool mirror_tunnel(void)
5436 /* Rerutn FALSE if cancelled */
5437 if (!tgt_pt(&x, &y)) return FALSE;
5439 if (dimension_door_aux(x, y)) return TRUE;
5442 msg_print("¶À¤ÎÀ¤³¦¤ò¤¦¤Þ¤¯Ä̤ì¤Ê¤«¤Ã¤¿¡ª");
5444 msg_print("You fail to pass the mirror plane correctly!");
5451 bool eat_magic(int power)
5453 object_type * o_ptr;
5456 int recharge_strength = 0;
5462 char o_name[MAX_NLEN];
5464 item_tester_hook = item_tester_hook_recharge;
5468 q = "¤É¤Î¥¢¥¤¥Æ¥à¤«¤éËâÎϤòµÛ¼ý¤·¤Þ¤¹¤«¡©";
5469 s = "ËâÎϤòµÛ¼ý¤Ç¤¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£";
5471 q = "Drain which item? ";
5472 s = "You have nothing to drain.";
5475 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return FALSE;
5479 o_ptr = &inventory[item];
5483 o_ptr = &o_list[0 - item];
5486 k_ptr = &k_info[o_ptr->k_idx];
5487 lev = k_info[o_ptr->k_idx].level;
5489 if (o_ptr->tval == TV_ROD)
5491 recharge_strength = ((power > lev/2) ? (power - lev/2) : 0) / 5;
5494 if (one_in_(recharge_strength))
5496 /* Activate the failure code. */
5501 if (o_ptr->timeout > (o_ptr->number - 1) * k_ptr->pval)
5504 msg_print("½¼Å¶Ãæ¤Î¥í¥Ã¥É¤«¤éËâÎϤòµÛ¼ý¤¹¤ë¤³¤È¤Ï¤Ç¤¤Þ¤»¤ó¡£");
5506 msg_print("You can't absorb energy from a discharged rod.");
5513 o_ptr->timeout += k_ptr->pval;
5519 /* All staffs, wands. */
5520 recharge_strength = (100 + power - lev) / 15;
5523 if (recharge_strength < 0) recharge_strength = 0;
5526 if (one_in_(recharge_strength))
5528 /* Activate the failure code. */
5533 if (o_ptr->pval > 0)
5535 p_ptr->csp += lev / 2;
5538 /* XXX Hack -- unstack if necessary */
5539 if ((o_ptr->tval == TV_STAFF) && (item >= 0) && (o_ptr->number > 1))
5544 /* Get local object */
5547 /* Obtain a local object */
5548 object_copy(q_ptr, o_ptr);
5550 /* Modify quantity */
5553 /* Restore the charges */
5556 /* Unstack the used item */
5558 p_ptr->total_weight -= q_ptr->weight;
5559 item = inven_carry(q_ptr);
5563 msg_print("¾ó¤ò¤Þ¤È¤á¤Ê¤ª¤·¤¿¡£");
5565 msg_print("You unstack your staff.");
5573 msg_print("µÛ¼ý¤Ç¤¤ëËâÎϤ¬¤¢¤ê¤Þ¤»¤ó¡ª");
5575 msg_print("There's no energy there to absorb!");
5579 if (!o_ptr->pval) o_ptr->ident |= IDENT_EMPTY;
5583 /* Inflict the penalties for failing a recharge. */
5586 /* Artifacts are never destroyed. */
5587 if (object_is_fixed_artifact(o_ptr))
5589 object_desc(o_name, o_ptr, OD_NAME_ONLY);
5591 msg_format("ËâÎϤ¬µÕή¤·¤¿¡ª%s¤Ï´°Á´¤ËËâÎϤò¼º¤Ã¤¿¡£", o_name);
5593 msg_format("The recharging backfires - %s is completely drained!", o_name);
5597 /* Artifact rods. */
5598 if (o_ptr->tval == TV_ROD)
5599 o_ptr->timeout = k_ptr->pval * o_ptr->number;
5601 /* Artifact wands and staffs. */
5602 else if ((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_STAFF))
5607 /* Get the object description */
5608 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
5610 /*** Determine Seriousness of Failure ***/
5612 /* Mages recharge objects more safely. */
5613 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)
5615 /* 10% chance to blow up one rod, otherwise draining. */
5616 if (o_ptr->tval == TV_ROD)
5618 if (one_in_(10)) fail_type = 2;
5621 /* 75% chance to blow up one wand, otherwise draining. */
5622 else if (o_ptr->tval == TV_WAND)
5624 if (!one_in_(3)) fail_type = 2;
5627 /* 50% chance to blow up one staff, otherwise no effect. */
5628 else if (o_ptr->tval == TV_STAFF)
5630 if (one_in_(2)) fail_type = 2;
5635 /* All other classes get no special favors. */
5638 /* 33% chance to blow up one rod, otherwise draining. */
5639 if (o_ptr->tval == TV_ROD)
5641 if (one_in_(3)) fail_type = 2;
5644 /* 20% chance of the entire stack, else destroy one wand. */
5645 else if (o_ptr->tval == TV_WAND)
5647 if (one_in_(5)) fail_type = 3;
5650 /* Blow up one staff. */
5651 else if (o_ptr->tval == TV_STAFF)
5657 /*** Apply draining and destruction. ***/
5659 /* Drain object or stack of objects. */
5662 if (o_ptr->tval == TV_ROD)
5665 msg_print("¥í¥Ã¥É¤ÏÇË»¤òÌȤ줿¤¬¡¢ËâÎϤÏÁ´¤Æ¼º¤Ê¤ï¤ì¤¿¡£");
5667 msg_format("You save your rod from destruction, but all charges are lost.", o_name);
5670 o_ptr->timeout = k_ptr->pval * o_ptr->number;
5672 else if (o_ptr->tval == TV_WAND)
5675 msg_format("%s¤ÏÇË»¤òÌȤ줿¤¬¡¢ËâÎϤ¬Á´¤Æ¼º¤ï¤ì¤¿¡£", o_name);
5677 msg_format("You save your %s from destruction, but all charges are lost.", o_name);
5682 /* Staffs aren't drained. */
5685 /* Destroy an object or one in a stack of objects. */
5688 if (o_ptr->number > 1)
5691 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬°ìËܲõ¤ì¤¿¡ª", o_name);
5693 msg_format("Wild magic consumes one of your %s!", o_name);
5696 /* Reduce rod stack maximum timeout, drain wands. */
5697 if (o_ptr->tval == TV_ROD) o_ptr->timeout = MIN(o_ptr->timeout, k_ptr->pval * (o_ptr->number - 1));
5698 else if (o_ptr->tval == TV_WAND) o_ptr->pval = o_ptr->pval * (o_ptr->number - 1) / o_ptr->number;
5703 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²¿Ëܤ«²õ¤ì¤¿¡ª", o_name);
5705 msg_format("Wild magic consumes your %s!", o_name);
5708 /* Reduce and describe inventory */
5711 inven_item_increase(item, -1);
5712 inven_item_describe(item);
5713 inven_item_optimize(item);
5716 /* Reduce and describe floor item */
5719 floor_item_increase(0 - item, -1);
5720 floor_item_describe(0 - item);
5721 floor_item_optimize(0 - item);
5725 /* Destroy all members of a stack of objects. */
5728 if (o_ptr->number > 1)
5730 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬Á´¤Æ²õ¤ì¤¿¡ª", o_name);
5732 msg_format("Wild magic consumes all your %s!", o_name);
5737 msg_format("Íð˽¤ÊËâË¡¤Î¤¿¤á¤Ë%s¤¬²õ¤ì¤¿¡ª", o_name);
5739 msg_format("Wild magic consumes your %s!", o_name);
5744 /* Reduce and describe inventory */
5747 inven_item_increase(item, -999);
5748 inven_item_describe(item);
5749 inven_item_optimize(item);
5752 /* Reduce and describe floor item */
5755 floor_item_increase(0 - item, -999);
5756 floor_item_describe(0 - item);
5757 floor_item_optimize(0 - item);
5763 if (p_ptr->csp > p_ptr->msp)
5765 p_ptr->csp = p_ptr->msp;
5768 /* Redraw mana and hp */
5769 p_ptr->redraw |= (PR_MANA);
5771 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
5772 p_ptr->window |= (PW_INVEN);
5778 bool summon_kin_player(int level, int y, int x, u32b mode)
5780 bool pet = (bool)(mode & PM_FORCE_PET);
5781 if (!pet) mode |= PM_NO_PET;
5783 switch (p_ptr->mimic_form)
5786 switch (p_ptr->prace)
5790 case RACE_BARBARIAN:
5793 summon_kin_type = 'p';
5803 case RACE_MIND_FLAYER:
5806 summon_kin_type = 'h';
5809 summon_kin_type = 'o';
5811 case RACE_HALF_TROLL:
5812 summon_kin_type = 'T';
5814 case RACE_HALF_OGRE:
5815 summon_kin_type = 'O';
5817 case RACE_HALF_GIANT:
5818 case RACE_HALF_TITAN:
5820 summon_kin_type = 'P';
5823 summon_kin_type = 'y';
5826 summon_kin_type = 'K';
5829 summon_kin_type = 'k';
5832 if (one_in_(13)) summon_kin_type = 'U';
5833 else summon_kin_type = 'u';
5835 case RACE_DRACONIAN:
5836 summon_kin_type = 'd';
5840 summon_kin_type = 'g';
5843 if (one_in_(13)) summon_kin_type = 'L';
5844 else summon_kin_type = 's';
5847 summon_kin_type = 'z';
5850 summon_kin_type = 'V';
5853 summon_kin_type = 'G';
5856 summon_kin_type = 'I';
5859 summon_kin_type = '#';
5862 summon_kin_type = 'A';
5865 summon_kin_type = 'U';
5868 summon_kin_type = 'p';
5873 if (one_in_(13)) summon_kin_type = 'U';
5874 else summon_kin_type = 'u';
5876 case MIMIC_DEMON_LORD:
5877 summon_kin_type = 'U';
5880 summon_kin_type = 'V';
5883 return summon_specific((pet ? -1 : 0), y, x, level, SUMMON_KIN, mode);