3 /* Purpose: Inventory commands */
6 * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research, and
9 * not for profit purposes provided that this copyright and statement are
10 * included in all such copies.
20 void do_cmd_inven(void)
25 /* Note that we are in "inventory" mode */
28 #ifdef ALLOW_EASY_FLOOR
30 /* Note that we are in "inventory" mode */
31 if (easy_floor) command_wrk = (USE_INVEN);
33 #endif /* ALLOW_EASY_FLOOR */
38 /* Hack -- show empty slots */
39 item_tester_full = TRUE;
41 /* Display the inventory */
44 /* Hack -- hide empty slots */
45 item_tester_full = FALSE;
48 sprintf(out_val, "»ý¤Áʪ¡§ ¹ç·× %3d.%1d kg (¸Â³¦¤Î%ld%%) ¥³¥Þ¥ó¥É: ",
49 lbtokg1(p_ptr->total_weight) , lbtokg2(p_ptr->total_weight) ,
50 (p_ptr->total_weight * 100) / ((adj_str_wgt[p_ptr->stat_ind[A_STR]] * (p_ptr->pclass == CLASS_BERSERKER ? 150 : 100))
53 sprintf(out_val, "Inventory: carrying %d.%d pounds (%ld%% of capacity). Command: ",
54 (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
55 (p_ptr->total_weight * 100) / ((adj_str_wgt[p_ptr->stat_ind[A_STR]] * (p_ptr->pclass == CLASS_BERSERKER ? 150 : 100)) / 2));
62 /* Get a new command */
63 command_new = inkey();
69 /* Process "Escape" */
70 if (command_new == ESCAPE)
75 Term_get_size(&wid, &hgt);
79 command_gap = wid - 30;
82 /* Process normal keys */
85 /* Hack -- Use "display" mode */
94 void do_cmd_equip(void)
99 /* Note that we are in "equipment" mode */
102 #ifdef ALLOW_EASY_FLOOR
104 /* Note that we are in "equipment" mode */
105 if (easy_floor) command_wrk = (USE_EQUIP);
107 #endif /* ALLOW_EASY_FLOOR */
109 /* Save the screen */
112 /* Hack -- show empty slots */
113 item_tester_full = TRUE;
115 /* Display the equipment */
118 /* Hack -- undo the hack above */
119 item_tester_full = FALSE;
123 sprintf(out_val, "ÁõÈ÷¡§ ¹ç·× %3d.%1d kg (¸Â³¦¤Î%ld%%) ¥³¥Þ¥ó¥É: ",
124 lbtokg1(p_ptr->total_weight) , lbtokg2(p_ptr->total_weight) ,
125 (p_ptr->total_weight * 100) / ((adj_str_wgt[p_ptr->stat_ind[A_STR]] * (p_ptr->pclass == CLASS_BERSERKER ? 150 : 100))
128 sprintf(out_val, "Equipment: carrying %d.%d pounds (%ld%% of capacity). Command: ",
129 (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
130 (p_ptr->total_weight * 100) / ((adj_str_wgt[p_ptr->stat_ind[A_STR]] * (p_ptr->pclass == CLASS_BERSERKER ? 150 : 100)) / 2));
137 /* Get a new command */
138 command_new = inkey();
140 /* Restore the screen */
144 /* Process "Escape" */
145 if (command_new == ESCAPE)
150 Term_get_size(&wid, &hgt);
154 command_gap = wid - 30;
157 /* Process normal keys */
160 /* Enter "display" mode */
167 * The "wearable" tester
169 static bool item_tester_hook_wear(object_type *o_ptr)
171 if ((o_ptr->tval == TV_SOFT_ARMOR) && (o_ptr->sval == SV_ABUNAI_MIZUGI))
172 if (p_ptr->psex == SEX_MALE) return FALSE;
174 /* Check for a usable slot */
175 if (wield_slot(o_ptr) >= INVEN_RARM) return (TRUE);
177 /* Assume not wearable */
182 static bool item_tester_hook_mochikae(object_type *o_ptr)
184 /* Check for a usable slot */
185 if (((o_ptr->tval >= TV_DIGGING) && (o_ptr->tval <= TV_SWORD)) ||
186 (o_ptr->tval == TV_SHIELD) || (o_ptr->tval == TV_CAPTURE) ||
187 (o_ptr->tval == TV_CARD)) return (TRUE);
189 /* Assume not wearable */
194 static bool item_tester_hook_melee_weapon(object_type *o_ptr)
196 /* Check for a usable slot */
197 if ((o_ptr->tval >= TV_DIGGING) && (o_ptr->tval <= TV_SWORD))return (TRUE);
199 /* Assume not wearable */
205 * Wield or wear a single item from the pack or floor
207 void do_cmd_wield(void)
218 char o_name[MAX_NLEN];
222 if (p_ptr->special_defense & KATA_MUSOU)
224 set_action(ACTION_NONE);
227 /* Restrict the choices */
228 item_tester_hook = item_tester_hook_wear;
232 q = "¤É¤ì¤òÁõÈ÷¤·¤Þ¤¹¤«? ";
233 s = "ÁõÈ÷²Äǽ¤Ê¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
235 q = "Wear/Wield which item? ";
236 s = "You have nothing you can wear or wield.";
239 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
241 /* Get the item (in the pack) */
244 o_ptr = &inventory[item];
247 /* Get the item (on the floor) */
250 o_ptr = &o_list[0 - item];
255 slot = wield_slot(o_ptr);
256 #if 1 /* EASY_RING -- TNB */
258 if ((o_ptr->tval == TV_RING) && inventory[INVEN_LEFT].k_idx &&
259 inventory[INVEN_RIGHT].k_idx)
261 /* Restrict the choices */
262 item_tester_tval = TV_RING;
263 item_tester_no_ryoute = TRUE;
265 /* Choose a ring from the equipment only */
267 q = "¤É¤Á¤é¤Î»ØÎؤȼè¤êÂؤ¨¤Þ¤¹¤«?";
269 q = "Replace which ring? ";
278 if (!get_item(&slot, q, s, (USE_EQUIP)))
282 #endif /* EASY_RING -- TNB */
284 if (((o_ptr->tval == TV_SHIELD) || (o_ptr->tval == TV_CARD) || (o_ptr->tval == TV_CAPTURE)) &&
285 buki_motteruka(INVEN_RARM) && buki_motteruka(INVEN_LARM))
287 /* Restrict the choices */
288 item_tester_hook = item_tester_hook_melee_weapon;
289 item_tester_no_ryoute = TRUE;
291 /* Choose a weapon from the equipment only */
293 q = "¤É¤Á¤é¤ÎÉð´ï¤È¼è¤êÂؤ¨¤Þ¤¹¤«?";
295 q = "Replace which weapon? ";
304 if (!get_item(&slot, q, s, (USE_EQUIP)))
306 if (slot == INVEN_RARM)
308 object_type *or_ptr = &inventory[INVEN_RARM];
309 object_type *ol_ptr = &inventory[INVEN_LARM];
310 object_type *otmp_ptr;
311 object_type object_tmp;
312 char ol_name[MAX_NLEN];
314 otmp_ptr = &object_tmp;
316 object_desc(ol_name, ol_ptr, FALSE, 0);
318 object_copy(otmp_ptr, ol_ptr);
319 object_copy(ol_ptr, or_ptr);
320 object_copy(or_ptr, otmp_ptr);
322 msg_format("%s¤ò%s¤Ë¹½¤¨¤Ê¤ª¤·¤¿¡£", ol_name, left_hander ? "º¸¼ê" : "±¦¼ê");
324 msg_format("You wield %s at %s hand.", ol_name, left_hander ? "left" : "right");
331 /* ÆóÅáή¤Ë¤¹¤ë¤«¤É¤¦¤« */
332 if ((o_ptr->tval >= TV_DIGGING) && (o_ptr->tval <= TV_SWORD) && (slot == INVEN_LARM))
335 if (!get_check("ÆóÅáή¤ÇÀ襤¤Þ¤¹¤«¡©"))
337 if (!get_check("Dual wielding? "))
344 if ((o_ptr->tval >= TV_DIGGING) && (o_ptr->tval <= TV_SWORD) &&
345 inventory[INVEN_LARM].k_idx &&
346 inventory[INVEN_RARM].k_idx)
348 /* Restrict the choices */
349 item_tester_hook = item_tester_hook_mochikae;
351 /* Choose a ring from the equipment only */
353 q = "¤É¤Á¤é¤Î¼ê¤ËÁõÈ÷¤·¤Þ¤¹¤«?";
355 q = "Equip which hand? ";
364 if (!get_item(&slot, q, s, (USE_EQUIP)))
368 /* Prevent wielding into a cursed slot */
369 if (cursed_p(&inventory[slot]))
372 object_desc(o_name, &inventory[slot], FALSE, 0);
376 msg_format("%s%s¤Ï¼ö¤ï¤ì¤Æ¤¤¤ë¤è¤¦¤À¡£",
377 describe_use(slot) , o_name );
379 msg_format("The %s you are %s appears to be cursed.",
380 o_name, describe_use(slot));
384 /* Cancel the command */
388 if (cursed_p(o_ptr) && confirm_wear &&
389 (object_known_p(o_ptr) || (o_ptr->ident & IDENT_SENSE)))
391 char dummy[MAX_NLEN+80];
394 object_desc(o_name, o_ptr, FALSE, 0);
397 sprintf(dummy, "ËÜÅö¤Ë%s{¼ö¤ï¤ì¤Æ¤¤¤ë}¤ò»È¤¤¤Þ¤¹¤«¡©", o_name);
399 sprintf(dummy, "Really use the %s {cursed}? ", o_name);
403 if (!get_check(dummy))
407 if ((o_ptr->name1 == ART_STONEMASK) && object_known_p(o_ptr) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
409 char dummy[MAX_NLEN+80];
412 object_desc(o_name, o_ptr, FALSE, 0);
415 sprintf(dummy, "%s¤òÁõÈ÷¤¹¤ë¤ÈµÛ·ìµ´¤Ë¤Ê¤ê¤Þ¤¹¡£¤è¤í¤·¤¤¤Ç¤¹¤«¡©", o_name);
417 msg_format("%s will transforms you into a vampire permanently when equiped.", o_name);
418 sprintf(dummy, "Do you become a vampire?");
422 if (!get_check(dummy))
426 /* Check if completed a quest */
427 for (i = 0; i < max_quests; i++)
429 if ((quest[i].type == QUEST_TYPE_FIND_ARTIFACT) &&
430 (quest[i].status == QUEST_STATUS_TAKEN) &&
431 (quest[i].k_idx == o_ptr->name1))
433 if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, i, NULL);
434 quest[i].status = QUEST_STATUS_COMPLETED;
435 quest[i].complev = (byte)p_ptr->lev;
437 msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª");
439 msg_print("You completed the quest!");
446 if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN) identify_item(o_ptr);
451 /* Get local object */
454 /* Obtain local object */
455 object_copy(q_ptr, o_ptr);
457 /* Modify quantity */
460 /* Decrease the item (from the pack) */
463 inven_item_increase(item, -1);
464 inven_item_optimize(item);
467 /* Decrease the item (from the floor) */
470 floor_item_increase(0 - item, -1);
471 floor_item_optimize(0 - item);
474 /* Access the wield slot */
475 o_ptr = &inventory[slot];
477 /* Take off existing item */
480 /* Take off existing item */
481 (void)inven_takeoff(slot, 255);
484 /* Wear the new stuff */
485 object_copy(o_ptr, q_ptr);
487 /* Increase the weight */
488 p_ptr->total_weight += q_ptr->weight;
490 /* Increment the equip counter by hand */
493 /* Where is the item now */
494 if (slot == INVEN_RARM)
496 if((o_ptr->tval != TV_SHIELD) && (o_ptr->tval != TV_CAPTURE) && (o_ptr->tval != TV_CARD) && (empty_hands(FALSE) & 0x00000001) && ((o_ptr->weight > 99) || (o_ptr->tval == TV_POLEARM)) && (!p_ptr->riding || (p_ptr->pet_extra_flags & PF_RYOUTE)))
498 act = "¤òξ¼ê¤Ç¹½¤¨¤¿";
500 act = "You are wielding";
504 act = (left_hander ? "¤òº¸¼ê¤ËÁõÈ÷¤·¤¿" : "¤ò±¦¼ê¤ËÁõÈ÷¤·¤¿");
506 act = "You are wielding";
510 else if (slot == INVEN_LARM)
513 act = (left_hander ? "¤ò±¦¼ê¤ËÁõÈ÷¤·¤¿" : "¤òº¸¼ê¤ËÁõÈ÷¤·¤¿");
515 act = "You are wielding";
519 else if (slot == INVEN_BOW)
522 act = "¤ò¼Í·âÍѤËÁõÈ÷¤·¤¿";
524 act = "You are shooting with";
528 else if (slot == INVEN_LITE)
531 act = "¤ò¸÷¸»¤Ë¤·¤¿";
533 act = "Your light source is";
542 act = "You are wearing";
547 /* Describe the result */
548 object_desc(o_name, o_ptr, TRUE, 3);
552 msg_format("%s(%c)%s¡£", o_name, index_to_label(slot), act );
554 msg_format("%s %s (%c).", act, o_name, index_to_label(slot));
561 /* Warn the player */
563 msg_print("¤¦¤ï¡ª ¤¹¤µ¤Þ¤¸¤¯Î䤿¤¤¡ª");
565 msg_print("Oops! It feels deathly cold!");
569 chg_virtue(V_HARMONY, -1);
572 o_ptr->ident |= (IDENT_SENSE);
575 if ((o_ptr->name1 == ART_STONEMASK) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
578 if (p_ptr->prace < 32)
580 p_ptr->old_race1 |= 1L << p_ptr->prace;
584 p_ptr->old_race2 = 1L << (p_ptr->prace-32);
586 p_ptr->prace = RACE_VAMPIRE;
588 msg_format("¤¢¤Ê¤¿¤ÏµÛ·ìµ´¤ËÊѲ½¤·¤¿¡ª");
590 msg_format("You polymorphed into a vampire!");
593 rp_ptr = &race_info[p_ptr->prace];
595 /* Experience factor */
596 p_ptr->expfact = rp_ptr->r_exp + cp_ptr->c_exp;
598 /* Calculate the height/weight for males */
599 if (p_ptr->psex == SEX_MALE)
601 p_ptr->ht = randnor(rp_ptr->m_b_ht, rp_ptr->m_m_ht);
602 h_percent = (int)(p_ptr->ht) * 100 / (int)(rp_ptr->m_b_ht);
603 p_ptr->wt = randnor((int)(rp_ptr->m_b_wt) * h_percent /100
604 , (int)(rp_ptr->m_m_wt) * h_percent / 300 );
607 /* Calculate the height/weight for females */
608 else if (p_ptr->psex == SEX_FEMALE)
610 p_ptr->ht = randnor(rp_ptr->f_b_ht, rp_ptr->f_m_ht);
611 h_percent = (int)(p_ptr->ht) * 100 / (int)(rp_ptr->f_b_ht);
612 p_ptr->wt = randnor((int)(rp_ptr->f_b_wt) * h_percent /100
613 , (int)(rp_ptr->f_m_wt) * h_percent / 300 );
619 if (p_ptr->pclass == CLASS_SORCERER)
620 p_ptr->hitdie = rp_ptr->r_mhp/2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
622 p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
624 do_cmd_rerate(FALSE);
626 p_ptr->redraw |= (PR_BASIC);
628 p_ptr->update |= (PU_BONUS);
634 /* Recalculate bonuses */
635 p_ptr->update |= (PU_BONUS);
637 /* Recalculate torch */
638 p_ptr->update |= (PU_TORCH);
640 /* Recalculate mana */
641 p_ptr->update |= (PU_MANA);
643 p_ptr->redraw |= (PR_EQUIPPY);
646 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
652 void kamaenaoshi(int item)
654 object_type *o_ptr, *o2_ptr;
655 char o_name[MAX_NLEN];
657 if ((item == INVEN_RARM) && buki_motteruka(INVEN_LARM))
659 o_ptr = &inventory[INVEN_RARM];
660 o2_ptr = &inventory[INVEN_LARM];
661 object_copy(o_ptr, o2_ptr);
662 p_ptr->total_weight += o2_ptr->weight;
663 inven_item_increase(INVEN_LARM,-1);
664 inven_item_optimize(INVEN_LARM);
665 object_desc(o_name, o_ptr, TRUE, 3);
666 if (((o_ptr->weight > 99) || (o_ptr->tval == TV_POLEARM)) && (!p_ptr->riding || (p_ptr->pet_extra_flags & PF_RYOUTE)))
668 msg_format("%s¤òξ¼ê¤Ç¹½¤¨¤¿¡£", o_name );
670 msg_format("You are wielding %s with two-handed.", o_name );
674 msg_format("%s¤ò%s¤Ç¹½¤¨¤¿¡£", o_name, (left_hander ? "º¸¼ê" : "±¦¼ê"));
676 msg_format("You are wielding %s with %s hand.", o_name, (left_hander ? "left":"right") );
679 else if ((item == INVEN_LARM) && buki_motteruka(INVEN_RARM))
681 o_ptr = &inventory[INVEN_RARM];
682 object_desc(o_name, o_ptr, TRUE, 3);
683 if (((o_ptr->weight > 99) || (o_ptr->tval == TV_POLEARM)) && (!p_ptr->riding || (p_ptr->pet_extra_flags & PF_RYOUTE)))
685 msg_format("%s¤òξ¼ê¤Ç¹½¤¨¤¿¡£", o_name );
687 msg_format("You are wielding %s with two-handed.", o_name );
690 else if ((item == INVEN_LARM) && !(empty_hands(FALSE) & 0x0002))
692 o_ptr = &inventory[INVEN_LARM];
693 o2_ptr = &inventory[INVEN_RARM];
694 object_copy(o_ptr, o2_ptr);
695 p_ptr->total_weight += o2_ptr->weight;
696 inven_item_increase(INVEN_RARM,-1);
697 inven_item_optimize(INVEN_RARM);
698 object_desc(o_name, o_ptr, TRUE, 3);
700 msg_format("%s¤ò»ý¤ÁÂؤ¨¤¿¡£", o_name );
702 msg_format("You switched hand of %s.", o_name );
711 void do_cmd_takeoff(void)
719 if (p_ptr->special_defense & KATA_MUSOU)
721 set_action(ACTION_NONE);
724 item_tester_no_ryoute = TRUE;
727 q = "¤É¤ì¤òÁõÈ÷¤«¤é¤Ï¤º¤·¤Þ¤¹¤«? ";
728 s = "¤Ï¤º¤»¤ëÁõÈ÷¤¬¤Ê¤¤¡£";
730 q = "Take off which item? ";
731 s = "You are not wearing anything to take off.";
734 if (!get_item(&item, q, s, (USE_EQUIP))) return;
736 /* Get the item (in the pack) */
739 o_ptr = &inventory[item];
742 /* Get the item (on the floor) */
745 o_ptr = &o_list[0 - item];
752 if ((o_ptr->curse_flags & TRC_PERMA_CURSE) || (p_ptr->pclass != CLASS_BERSERKER))
756 msg_print("¤Õ¡¼¤à¡¢¤É¤¦¤ä¤é¼ö¤ï¤ì¤Æ¤¤¤ë¤è¤¦¤À¡£");
758 msg_print("Hmmm, it seems to be cursed.");
765 if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && one_in_(7)) || one_in_(4))
768 msg_print("¼ö¤ï¤ì¤¿ÁõÈ÷¤òÎϤŤ¯¤ÇÇí¤¬¤·¤¿¡ª");
770 msg_print("You teared a cursed equipment off by sheer strength!");
773 /* Hack -- Assume felt */
774 o_ptr->ident |= (IDENT_SENSE);
776 o_ptr->curse_flags = 0L;
779 o_ptr->feeling = FEEL_NONE;
781 /* Recalculate the bonuses */
782 p_ptr->update |= (PU_BONUS);
785 p_ptr->window |= (PW_EQUIP);
788 msg_print("¼ö¤¤¤òÂǤÁÇˤä¿¡£");
790 msg_print("You break the curse.");
796 msg_print("ÁõÈ÷¤ò³°¤»¤Ê¤«¤Ã¤¿¡£");
798 msg_print("You couldn't remove the equipment.");
805 /* Take a partial turn */
808 /* Take off the item */
809 (void)inven_takeoff(item, 255);
815 p_ptr->redraw |= (PR_EQUIPPY);
822 void do_cmd_drop(void)
830 if (p_ptr->special_defense & KATA_MUSOU)
832 set_action(ACTION_NONE);
835 item_tester_no_ryoute = TRUE;
838 q = "¤É¤Î¥¢¥¤¥Æ¥à¤òÍî¤È¤·¤Þ¤¹¤«? ";
839 s = "Íî¤È¤»¤ë¥¢¥¤¥Æ¥à¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡£";
841 q = "Drop which item? ";
842 s = "You have nothing to drop.";
845 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN))) return;
847 /* Get the item (in the pack) */
850 o_ptr = &inventory[item];
853 /* Get the item (on the floor) */
856 o_ptr = &o_list[0 - item];
860 /* Hack -- Cannot remove cursed items */
861 if ((item >= INVEN_RARM) && cursed_p(o_ptr))
865 msg_print("¤Õ¡¼¤à¡¢¤É¤¦¤ä¤é¼ö¤ï¤ì¤Æ¤¤¤ë¤è¤¦¤À¡£");
867 msg_print("Hmmm, it seems to be cursed.");
876 /* See how many items */
877 if (o_ptr->number > 1)
880 amt = get_quantity(NULL, o_ptr->number);
882 /* Allow user abort */
883 if (amt <= 0) return;
887 /* Take a partial turn */
890 /* Drop (some of) the item */
891 inven_drop(item, amt);
893 if ((item == INVEN_RARM) || (item == INVEN_LARM)) kamaenaoshi(item);
895 if (item >= INVEN_RARM) calc_android_exp();
897 p_ptr->redraw |= (PR_EQUIPPY);
901 static bool high_level_book(object_type *o_ptr)
903 if ((o_ptr->tval == TV_LIFE_BOOK) ||
904 (o_ptr->tval == TV_SORCERY_BOOK) ||
905 (o_ptr->tval == TV_NATURE_BOOK) ||
906 (o_ptr->tval == TV_CHAOS_BOOK) ||
907 (o_ptr->tval == TV_DEATH_BOOK) ||
908 (o_ptr->tval == TV_TRUMP_BOOK) ||
909 (o_ptr->tval == TV_ENCHANT_BOOK) ||
910 (o_ptr->tval == TV_DAEMON_BOOK) ||
911 (o_ptr->tval == TV_CRUSADE_BOOK) ||
912 (o_ptr->tval == TV_MUSIC_BOOK))
927 void do_cmd_destroy(void)
936 object_type *q_ptr = &forge;
938 char o_name[MAX_NLEN];
940 char out_val[MAX_NLEN+40];
944 if (p_ptr->special_defense & KATA_MUSOU)
946 set_action(ACTION_NONE);
949 /* Hack -- force destruction */
950 if (command_arg > 0) force = TRUE;
955 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò²õ¤·¤Þ¤¹¤«? ";
956 s = "²õ¤»¤ë¥¢¥¤¥Æ¥à¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡£";
958 q = "Destroy which item? ";
959 s = "You have nothing to destroy.";
962 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
964 /* Get the item (in the pack) */
967 o_ptr = &inventory[item];
970 /* Get the item (on the floor) */
973 o_ptr = &o_list[0 - item];
977 /* See how many items */
978 if (o_ptr->number > 1)
981 amt = get_quantity(NULL, o_ptr->number);
983 /* Allow user abort */
984 if (amt <= 0) return;
988 /* Describe the object */
989 old_number = o_ptr->number;
991 object_desc(o_name, o_ptr, TRUE, 3);
992 o_ptr->number = old_number;
994 /* Verify unless quantity given */
997 if (confirm_destroy || (object_value(o_ptr) > 0))
999 /* Make a verification */
1001 sprintf(out_val, "ËÜÅö¤Ë%s¤ò²õ¤·¤Þ¤¹¤«? ", o_name);
1003 sprintf(out_val, "Really destroy %s? ", o_name);
1006 if (!get_check(out_val)) return;
1013 /* Artifacts cannot be destroyed */
1014 if (!can_player_destroy_object(o_ptr))
1020 msg_format("%s¤ÏÇ˲õÉÔ²Äǽ¤À¡£", o_name);
1022 msg_format("You cannot destroy %s.", o_name);
1029 object_copy(q_ptr, o_ptr);
1033 msg_format("%s¤ò²õ¤·¤¿¡£", o_name);
1035 msg_format("You destroy %s.", o_name);
1038 sound(SOUND_DESTITEM);
1040 /* Reduce the charges of rods/wands */
1041 reduce_charges(o_ptr, amt);
1043 /* Eliminate the item (from the pack) */
1046 inven_item_increase(item, -amt);
1047 inven_item_describe(item);
1048 inven_item_optimize(item);
1051 /* Eliminate the item (from the floor) */
1054 floor_item_increase(0 - item, -amt);
1055 floor_item_describe(0 - item);
1056 floor_item_optimize(0 - item);
1059 if (high_level_book(q_ptr))
1061 bool gain_expr = FALSE;
1063 if (p_ptr->prace == RACE_ANDROID)
1066 else if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_BERSERKER))
1070 else if (p_ptr->pclass == CLASS_PALADIN)
1072 if (is_good_realm(p_ptr->realm1))
1074 if (!is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
1078 if (is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
1082 if (gain_expr && (p_ptr->exp < PY_MAX_EXP))
1084 s32b tester_exp = p_ptr->max_exp / 20;
1085 if (tester_exp > 10000) tester_exp = 10000;
1086 if (q_ptr->sval < 3) tester_exp /= 4;
1087 if (tester_exp<1) tester_exp = 1;
1090 msg_print("¹¹¤Ë·Ð¸³¤òÀѤó¤À¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
1092 msg_print("You feel more experienced.");
1095 gain_exp(tester_exp * amt);
1097 if (high_level_book(q_ptr) && q_ptr->tval == TV_LIFE_BOOK)
1099 chg_virtue(V_UNLIFE, 1);
1100 chg_virtue(V_VITALITY, -1);
1102 else if (high_level_book(q_ptr) && q_ptr->tval == TV_DEATH_BOOK)
1104 chg_virtue(V_UNLIFE, -1);
1105 chg_virtue(V_VITALITY, 1);
1108 if (q_ptr->to_a || q_ptr->to_h || q_ptr->to_d)
1109 chg_virtue(V_ENCHANT, -1);
1111 if (object_value_real(q_ptr) > 30000)
1112 chg_virtue(V_SACRIFICE, 2);
1114 else if (object_value_real(q_ptr) > 10000)
1115 chg_virtue(V_SACRIFICE, 1);
1118 if (q_ptr->to_a != 0 || q_ptr->to_d != 0 || q_ptr->to_h != 0)
1119 chg_virtue(V_HARMONY, 1);
1121 if (item >= INVEN_RARM) calc_android_exp();
1126 * Observe an item which has been *identify*-ed
1128 void do_cmd_observe(void)
1134 char o_name[MAX_NLEN];
1138 item_tester_no_ryoute = TRUE;
1141 q = "¤É¤Î¥¢¥¤¥Æ¥à¤òÄ´¤Ù¤Þ¤¹¤«? ";
1142 s = "Ä´¤Ù¤é¤ì¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
1144 q = "Examine which item? ";
1145 s = "You have nothing to examine.";
1148 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return;
1150 /* Get the item (in the pack) */
1153 o_ptr = &inventory[item];
1156 /* Get the item (on the floor) */
1159 o_ptr = &o_list[0 - item];
1163 /* Require full knowledge */
1164 if (!(o_ptr->ident & IDENT_MENTAL))
1167 msg_print("¤³¤Î¥¢¥¤¥Æ¥à¤Ë¤Ä¤¤¤ÆÆäËÃΤäƤ¤¤ë¤³¤È¤Ï¤Ê¤¤¡£");
1169 msg_print("You have no special knowledge about that item.");
1177 object_desc(o_name, o_ptr, TRUE, 3);
1181 msg_format("%s¤òÄ´¤Ù¤Æ¤¤¤ë...", o_name);
1183 msg_format("Examining %s...", o_name);
1186 /* Describe it fully */
1188 if (!screen_object(o_ptr, TRUE)) msg_print("ÆäËÊѤï¤Ã¤¿¤È¤³¤í¤Ï¤Ê¤¤¤è¤¦¤À¡£");
1190 if (!screen_object(o_ptr, TRUE)) msg_print("You see nothing special.");
1198 * Remove the inscription from an object
1199 * XXX Mention item (when done)?
1201 void do_cmd_uninscribe(void)
1209 item_tester_no_ryoute = TRUE;
1212 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ÎÌäò¾Ã¤·¤Þ¤¹¤«? ";
1213 s = "Ìäò¾Ã¤»¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
1215 q = "Un-inscribe which item? ";
1216 s = "You have nothing to un-inscribe.";
1219 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return;
1221 /* Get the item (in the pack) */
1224 o_ptr = &inventory[item];
1227 /* Get the item (on the floor) */
1230 o_ptr = &o_list[0 - item];
1233 /* Nothing to remove */
1234 if (!o_ptr->inscription)
1237 msg_print("¤³¤Î¥¢¥¤¥Æ¥à¤Ë¤Ï¾Ã¤¹¤Ù¤Ì䬤ʤ¤¡£");
1239 msg_print("That item had no inscription to remove.");
1247 msg_print("Ìäò¾Ã¤·¤¿¡£");
1249 msg_print("Inscription removed.");
1253 /* Remove the incription */
1254 o_ptr->inscription = 0;
1256 /* Combine the pack */
1257 p_ptr->notice |= (PN_COMBINE);
1260 p_ptr->window |= (PW_INVEN | PW_EQUIP);
1262 /* .¤ä$¤Î´Ø·¸¤Ç, ºÆ·×»»¤¬É¬ÍפʤϤº -- henkma */
1263 p_ptr->update |= (PU_BONUS);
1269 * Inscribe an object with a comment
1271 void do_cmd_inscribe(void)
1277 char o_name[MAX_NLEN];
1283 item_tester_no_ryoute = TRUE;
1286 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ËÌäò¹ï¤ß¤Þ¤¹¤«? ";
1287 s = "Ìäò¹ï¤á¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
1289 q = "Inscribe which item? ";
1290 s = "You have nothing to inscribe.";
1293 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return;
1295 /* Get the item (in the pack) */
1298 o_ptr = &inventory[item];
1301 /* Get the item (on the floor) */
1304 o_ptr = &o_list[0 - item];
1307 /* Describe the activity */
1308 object_desc(o_name, o_ptr, TRUE, 2);
1312 msg_format("%s¤ËÌäò¹ï¤à¡£", o_name);
1314 msg_format("Inscribing %s.", o_name);
1319 /* Start with nothing */
1320 strcpy(out_val, "");
1322 /* Use old inscription */
1323 if (o_ptr->inscription)
1325 /* Start with the old inscription */
1326 strcpy(out_val, quark_str(o_ptr->inscription));
1329 /* Get a new inscription (possibly empty) */
1331 if (get_string("ÌÃ: ", out_val, 80))
1333 if (get_string("Inscription: ", out_val, 80))
1336 /* Save the inscription */
1337 o_ptr->inscription = quark_add(out_val);
1339 /* Combine the pack */
1340 p_ptr->notice |= (PN_COMBINE);
1343 p_ptr->window |= (PW_INVEN | PW_EQUIP);
1345 /* .¤ä$¤Î´Ø·¸¤Ç, ºÆ·×»»¤¬É¬ÍפʤϤº -- henkma */
1346 p_ptr->update |= (PU_BONUS);
1353 * An "item_tester_hook" for refilling lanterns
1355 static bool item_tester_refill_lantern(object_type *o_ptr)
1357 /* Flasks of oil are okay */
1358 if (o_ptr->tval == TV_FLASK) return (TRUE);
1360 /* Laterns are okay */
1361 if ((o_ptr->tval == TV_LITE) &&
1362 (o_ptr->sval == SV_LITE_LANTERN)) return (TRUE);
1364 /* Assume not okay */
1370 * Refill the players lamp (from the pack or floor)
1372 static void do_cmd_refill_lamp(void)
1382 /* Restrict the choices */
1383 item_tester_hook = item_tester_refill_lantern;
1387 q = "¤É¤ÎÌý¤Ä¤Ü¤«¤éÃí¤®¤Þ¤¹¤«? ";
1388 s = "Ìý¤Ä¤Ü¤¬¤Ê¤¤¡£";
1390 q = "Refill with which flask? ";
1391 s = "You have no flasks of oil.";
1394 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
1396 /* Get the item (in the pack) */
1399 o_ptr = &inventory[item];
1402 /* Get the item (on the floor) */
1405 o_ptr = &o_list[0 - item];
1409 /* Take a partial turn */
1412 /* Access the lantern */
1413 j_ptr = &inventory[INVEN_LITE];
1416 j_ptr->xtra4 += o_ptr->xtra4;
1420 msg_print("¥é¥ó¥×¤ËÌý¤òÃí¤¤¤À¡£");
1422 msg_print("You fuel your lamp.");
1426 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
1430 msg_print("¥é¥ó¥×¤¬¾Ã¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª");
1432 msg_print("Your lamp has gone out!");
1435 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
1439 msg_print("¤·¤«¤·¥é¥ó¥×¤ÏÁ´¤¯¸÷¤é¤Ê¤¤¡£");
1441 msg_print("Curiously, your lamp doesn't light.");
1444 else if (j_ptr->xtra4 >= FUEL_LAMP)
1446 j_ptr->xtra4 = FUEL_LAMP;
1448 msg_print("¥é¥ó¥×¤ÎÌý¤Ï°ìÇÕ¤À¡£");
1450 msg_print("Your lamp is full.");
1455 /* Decrease the item (from the pack) */
1458 inven_item_increase(item, -1);
1459 inven_item_describe(item);
1460 inven_item_optimize(item);
1463 /* Decrease the item (from the floor) */
1466 floor_item_increase(0 - item, -1);
1467 floor_item_describe(0 - item);
1468 floor_item_optimize(0 - item);
1471 /* Recalculate torch */
1472 p_ptr->update |= (PU_TORCH);
1477 * An "item_tester_hook" for refilling torches
1479 static bool item_tester_refill_torch(object_type *o_ptr)
1481 /* Torches are okay */
1482 if ((o_ptr->tval == TV_LITE) &&
1483 (o_ptr->sval == SV_LITE_TORCH)) return (TRUE);
1485 /* Assume not okay */
1491 * Refuel the players torch (from the pack or floor)
1493 static void do_cmd_refill_torch(void)
1503 /* Restrict the choices */
1504 item_tester_hook = item_tester_refill_torch;
1508 q = "¤É¤Î¾¾ÌÀ¤ÇÌÀ¤«¤ê¤ò¶¯¤á¤Þ¤¹¤«? ";
1509 s = "¾¤Ë¾¾ÌÀ¤¬¤Ê¤¤¡£";
1511 q = "Refuel with which torch? ";
1512 s = "You have no extra torches.";
1515 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
1517 /* Get the item (in the pack) */
1520 o_ptr = &inventory[item];
1523 /* Get the item (on the floor) */
1526 o_ptr = &o_list[0 - item];
1530 /* Take a partial turn */
1533 /* Access the primary torch */
1534 j_ptr = &inventory[INVEN_LITE];
1537 j_ptr->xtra4 += o_ptr->xtra4 + 5;
1541 msg_print("¾¾ÌÀ¤ò·ë¹ç¤·¤¿¡£");
1543 msg_print("You combine the torches.");
1548 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
1552 msg_print("¾¾ÌÀ¤¬¾Ã¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª");
1554 msg_print("Your torch has gone out!");
1557 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
1561 msg_print("¤·¤«¤·¾¾ÌÀ¤ÏÁ´¤¯¸÷¤é¤Ê¤¤¡£");
1563 msg_print("Curiously, your torche don't light.");
1566 /* Over-fuel message */
1567 else if (j_ptr->xtra4 >= FUEL_TORCH)
1569 j_ptr->xtra4 = FUEL_TORCH;
1571 msg_print("¾¾ÌÀ¤Î¼÷Ì¿¤Ï½½Ê¬¤À¡£");
1573 msg_print("Your torch is fully fueled.");
1578 /* Refuel message */
1582 msg_print("¾¾ÌÀ¤Ï¤¤¤Ã¤½¤¦ÌÀ¤ë¤¯µ±¤¤¤¿¡£");
1584 msg_print("Your torch glows more brightly.");
1589 /* Decrease the item (from the pack) */
1592 inven_item_increase(item, -1);
1593 inven_item_describe(item);
1594 inven_item_optimize(item);
1597 /* Decrease the item (from the floor) */
1600 floor_item_increase(0 - item, -1);
1601 floor_item_describe(0 - item);
1602 floor_item_optimize(0 - item);
1605 /* Recalculate torch */
1606 p_ptr->update |= (PU_TORCH);
1611 * Refill the players lamp, or restock his torches
1613 void do_cmd_refill(void)
1618 o_ptr = &inventory[INVEN_LITE];
1620 if (p_ptr->special_defense & KATA_MUSOU)
1622 set_action(ACTION_NONE);
1626 if (o_ptr->tval != TV_LITE)
1629 msg_print("¸÷¸»¤òÁõÈ÷¤·¤Æ¤¤¤Ê¤¤¡£");
1631 msg_print("You are not wielding a light.");
1637 else if (o_ptr->sval == SV_LITE_LANTERN)
1639 do_cmd_refill_lamp();
1643 else if (o_ptr->sval == SV_LITE_TORCH)
1645 do_cmd_refill_torch();
1648 /* No torch to refill */
1652 msg_print("¤³¤Î¸÷¸»¤Ï¼÷Ì¿¤ò±ä¤Ð¤»¤Ê¤¤¡£");
1654 msg_print("Your light cannot be refilled.");
1664 void do_cmd_target(void)
1667 if (target_set(TARGET_KILL))
1670 msg_print("¥¿¡¼¥²¥Ã¥È·èÄê¡£");
1672 msg_print("Target Selected.");
1677 /* Target aborted */
1681 msg_print("¥¿¡¼¥²¥Ã¥È²ò½ü¡£");
1683 msg_print("Target Aborted.");
1694 void do_cmd_look(void)
1697 if (target_set(TARGET_LOOK))
1700 msg_print("¥¿¡¼¥²¥Ã¥È·èÄê¡£");
1702 msg_print("Target Selected.");
1711 * Allow the player to examine other sectors on the map
1713 void do_cmd_locate(void)
1715 int dir, y1, x1, y2, x2;
1724 get_screen_size(&wid, &hgt);
1727 /* Start at current panel */
1728 y2 = y1 = panel_row_min;
1729 x2 = x1 = panel_col_min;
1731 /* Show panels until done */
1734 /* Describe the location */
1735 if ((y2 == y1) && (x2 == x1))
1738 strcpy(tmp_val, "¿¿¾å");
1747 sprintf(tmp_val, "%s%s",
1748 ((y2 < y1) ? "ËÌ" : (y2 > y1) ? "Æî" : ""),
1749 ((x2 < x1) ? "À¾" : (x2 > x1) ? "Åì" : ""));
1751 sprintf(tmp_val, "%s%s of",
1752 ((y2 < y1) ? " North" : (y2 > y1) ? " South" : ""),
1753 ((x2 < x1) ? " West" : (x2 > x1) ? " East" : ""));
1758 /* Prepare to ask which way to look */
1761 "¥Þ¥Ã¥×°ÌÃÖ [%d(%02d),%d(%02d)] (¥×¥ì¥¤¥ä¡¼¤Î%s) Êý¸þ?",
1763 "Map sector [%d(%02d),%d(%02d)], which is%s your sector. Direction?",
1766 y2 / (hgt / 2), y2 % (hgt / 2),
1767 x2 / (wid / 2), x2 % (wid / 2), tmp_val);
1769 /* Assume no direction */
1772 /* Get a direction */
1777 /* Get a command (or Cancel) */
1778 if (!get_com(out_val, &command, TRUE)) break;
1780 /* Extract the action (if any) */
1781 dir = get_keymap_dir(command);
1790 /* Apply the motion */
1791 if (change_panel(ddy[dir], ddx[dir]))
1799 /* Recenter the map around the player */
1803 p_ptr->update |= (PU_MONSTERS);
1806 p_ptr->redraw |= (PR_MAP);
1809 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1818 * The table of "symbol info" -- each entry is a string of the form
1819 * "X:desc" where "X" is the trigger, and "desc" is the "info".
1821 static cptr ident_info[] =
1826 "\":¥¢¥ß¥å¥ì¥Ã¥È, ðô¾þ¤ê",
1827 "#:ÊÉ(±£¤·¥É¥¢)Ëô¤Ï¿¢Êª",
1829 "%:¹ÛÌ®(Íϴ䤫ÀбÑ)",
1834 "*:ºâÊõ¤ò´Þ¤ó¤À¹ÛÌ®¤Þ¤¿¤Ïµå·Á¤Î²øʪ",
1836 ",:¿©¤Ùʪ, ¤ª¤Ð¤±¥¥Î¥³",
1839 "/:´È¾õÉð´ï(¥¢¥Ã¥¯¥¹/¥Ñ¥¤¥¯/Åù)",
1843 "3:Éð´ïÀìÌ珤ÎÆþ¸ý",
1845 "5:Ï£¶â½Ñ¤ÎŹ¤ÎÆþ¸ý",
1847 "7:¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥È¤ÎÆþ¸ý",
1851 ";:²óÈò¤Î³¨Ê¸»ú/Çúȯ¤Î¥ë¡¼¥ó",
1860 "D:¸ÅÂå¥É¥é¥´¥ó/¥ï¥¤¥¢¡¼¥à",
1867 "K:¥¥é¡¼¡¦¥Ó¡¼¥È¥ë",
1873 "Q:¥¯¥¤¥ë¥¹¥ë¥°(Ì®ÂǤÄÆù²ô)",
1875 "S:ÃØéá/¥µ¥½¥ê/¥À¥Ë",
1879 "W:¥ï¥¤¥È/¥ì¥¤¥¹/Åù",
1880 "X:¥¾¡¼¥ó/¥¶¥ì¥ó/Åù",
1884 "\\:Æß´ï(¥á¥¤¥¹/¥à¥Á/Åù)",
1896 "h:¥Û¥Ó¥Ã¥È/¥¨¥ë¥Õ/¥É¥ï¡¼¥Õ",
1915 "{:Èô¤ÓÆ»¶ñ¤ÎÃÆ(Ìð/ÃÆ)",
1916 "|:Åá·õÎà(¥½¡¼¥É/¥À¥¬¡¼/Åù)",
1917 "}:Èô¤ÓÆ»¶ñ(µÝ/¥¯¥í¥¹¥Ü¥¦/¥¹¥ê¥ó¥°)",
1918 "~:¿å/ÍÏ´äή(¼ï¡¹¤Î¥¢¥¤¥Æ¥à)",
1921 "!:A potion (or oil)",
1922 "\":An amulet (or necklace)",
1923 "#:A wall (or secret door)",
1924 "$:Treasure (gold or gems)",
1925 "%:A vein (magma or quartz)",
1930 "*:A vein with treasure or a ball monster",
1932 ",:Food (or mushroom patch)",
1933 "-:A wand (or rod)",
1935 "/:A polearm (Axe/Pike/etc)",
1936 "0:Entrance to Museum",
1937 "1:Entrance to General Store",
1938 "2:Entrance to Armory",
1939 "3:Entrance to Weaponsmith",
1940 "4:Entrance to Temple",
1941 "5:Entrance to Alchemy shop",
1942 "6:Entrance to Magic store",
1943 "7:Entrance to Black Market",
1944 "8:Entrance to your home",
1945 "9:Entrance to the bookstore",
1947 ";:A glyph of warding / explosive rune",
1948 "<:An up staircase",
1950 ">:A down staircase",
1956 "D:Ancient Dragon/Wyrm",
1965 "M:Multi-Headed Reptile",
1969 "Q:Quylthulg (Pulsing Flesh Mound)",
1970 "R:Reptile/Amphibian",
1971 "S:Spider/Scorpion/Tick",
1975 "W:Wight/Wraith/etc",
1980 "\\:A hafted weapon (mace/whip/etc)",
1984 "`:A figurine or statue",
1992 "h:Hobbit/Elf/Dwarf",
1996 "l:Aquatic monster",
2011 "{:A missile (arrow/bolt/shot)",
2012 "|:An edged weapon (sword/dagger/etc)",
2013 "}:A launcher (bow/crossbow/sling)",
2014 "~:Fluid terrain (or miscellaneous item)",
2022 * Sorting hook -- Comp function -- see below
2024 * We use "u" to point to array of monster indexes,
2025 * and "v" to select the type of sorting to perform on "u".
2027 bool ang_sort_comp_hook(vptr u, vptr v, int a, int b)
2029 u16b *who = (u16b*)(u);
2031 u16b *why = (u16b*)(v);
2039 /* Sort by player kills */
2042 /* Extract player kills */
2043 z1 = r_info[w1].r_pkills;
2044 z2 = r_info[w2].r_pkills;
2046 /* Compare player kills */
2047 if (z1 < z2) return (TRUE);
2048 if (z1 > z2) return (FALSE);
2052 /* Sort by total kills */
2055 /* Extract total kills */
2056 z1 = r_info[w1].r_tkills;
2057 z2 = r_info[w2].r_tkills;
2059 /* Compare total kills */
2060 if (z1 < z2) return (TRUE);
2061 if (z1 > z2) return (FALSE);
2065 /* Sort by monster level */
2068 /* Extract levels */
2069 z1 = r_info[w1].level;
2070 z2 = r_info[w2].level;
2072 /* Compare levels */
2073 if (z1 < z2) return (TRUE);
2074 if (z1 > z2) return (FALSE);
2078 /* Sort by monster experience */
2081 /* Extract experience */
2082 z1 = r_info[w1].mexp;
2083 z2 = r_info[w2].mexp;
2085 /* Compare experience */
2086 if (z1 < z2) return (TRUE);
2087 if (z1 > z2) return (FALSE);
2091 /* Compare indexes */
2097 * Sorting hook -- Swap function -- see below
2099 * We use "u" to point to array of monster indexes,
2100 * and "v" to select the type of sorting to perform.
2102 void ang_sort_swap_hook(vptr u, vptr v, int a, int b)
2104 u16b *who = (u16b*)(u);
2117 * Identify a character, allow recall of monsters
2119 * Several "special" responses recall "multiple" monsters:
2121 * ^U (all unique monsters)
2122 * ^N (all non-unique monsters)
2124 * The responses may be sorted in several ways, see below.
2126 * Note that the player ghosts are ignored. XXX XXX XXX
2128 void do_cmd_query_symbol(void)
2139 bool recall = FALSE;
2144 /* Get a character, or abort */
2146 if (!get_com("ÃΤꤿ¤¤Ê¸»ú¤òÆþÎϤ·¤Æ²¼¤µ¤¤(µ¹æ or ^AÁ´,^U¥æ,^NÈó¥æ,^M̾Á°): ", &sym, FALSE)) return;
2148 if (!get_com("Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): ", &sym, FALSE)) return;
2152 /* Find that character info, and describe it */
2153 for (i = 0; ident_info[i]; ++i)
2155 if (sym == ident_info[i][0]) break;
2159 if (sym == KTRL('A'))
2163 strcpy(buf, "Á´¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
2165 strcpy(buf, "Full monster list.");
2169 else if (sym == KTRL('U'))
2173 strcpy(buf, "¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
2175 strcpy(buf, "Unique monster list.");
2179 else if (sym == KTRL('N'))
2183 strcpy(buf, "¥æ¥Ë¡¼¥¯³°¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
2185 strcpy(buf, "Non-unique monster list.");
2189 /* XTRA HACK WHATSEARCH */
2190 else if (sym == KTRL('M'))
2194 if (!get_string("̾Á°(±Ñ¸ì¤Î¾ì¹ç¾®Ê¸»ú¤Ç²Ä)",temp, 70))
2196 if (!get_string("Enter name:",temp, 70))
2203 sprintf(buf, "̾Á°:%s¤Ë¥Þ¥Ã¥Á",temp);
2205 sprintf(buf, "Monsters with a name \"%s\"",temp);
2208 else if (ident_info[i])
2210 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
2215 sprintf(buf, "%c - %s", sym, "̵¸ú¤Êʸ»ú");
2217 sprintf(buf, "%c - %s.", sym, "Unknown Symbol");
2222 /* Display the result */
2225 /* Allocate the "who" array */
2226 C_MAKE(who, max_r_idx, u16b);
2228 /* Collect matching monsters */
2229 for (n = 0, i = 1; i < max_r_idx; i++)
2231 monster_race *r_ptr = &r_info[i];
2233 /* Nothing to recall */
2234 if (!cheat_know && !r_ptr->r_sights) continue;
2236 /* Require non-unique monsters if needed */
2237 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
2239 /* Require unique monsters if needed */
2240 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
2242 /* XTRA HACK WHATSEARCH */
2247 for (xx=0; temp[xx] && xx<80; xx++){
2249 if (iskanji( temp[xx])) { xx++; continue; }
2251 if (isupper(temp[xx])) temp[xx]=tolower(temp[xx]);
2255 strcpy(temp2, r_name+r_ptr->E_name);
2257 strcpy(temp2, r_name+r_ptr->name);
2259 for (xx=0; temp2[xx] && xx<80; xx++)
2260 if (isupper(temp2[xx])) temp2[xx]=tolower(temp2[xx]);
2263 if (strstr(temp2, temp) || strstr_j(r_name + r_ptr->name, temp) )
2265 if (strstr(temp2, temp))
2269 /* Collect "appropriate" monsters */
2270 if (all || (r_ptr->d_char == sym)) who[n++] = i;
2273 /* Nothing to recall */
2276 /* Free the "who" array */
2277 C_KILL(who, max_r_idx, u16b);
2283 /* Prompt XXX XXX XXX */
2285 put_str("»×¤¤½Ð¤ò¸«¤Þ¤¹¤«? (k:»¦³²½ç/y/n): ", 0, 36);
2287 put_str("Recall details? (k/y/n): ", 0, 40);
2299 /* Select the sort method */
2300 ang_sort_comp = ang_sort_comp_hook;
2301 ang_sort_swap = ang_sort_swap_hook;
2303 /* Sort the array */
2304 ang_sort(who, &why, n);
2306 /* Sort by kills (and level) */
2313 /* Catch "escape" */
2316 /* Free the "who" array */
2317 C_KILL(who, max_r_idx, u16b);
2322 /* Sort if needed */
2325 /* Select the sort method */
2326 ang_sort_comp = ang_sort_comp_hook;
2327 ang_sort_swap = ang_sort_swap_hook;
2329 /* Sort the array */
2330 ang_sort(who, &why, n);
2334 /* Start at the end */
2337 /* Scan the monster memory */
2340 /* Extract a race */
2343 /* Hack -- Auto-recall */
2344 monster_race_track(r_idx);
2346 /* Hack -- Handle stuff */
2349 /* Hack -- Begin the prompt */
2352 /* Hack -- Complete the prompt */
2354 Term_addstr(-1, TERM_WHITE, " ['r'»×¤¤½Ð, ESC]");
2356 Term_addstr(-1, TERM_WHITE, " [(r)ecall, ESC]");
2366 /* Save the screen */
2369 /* Recall on screen */
2370 screen_roff(who[i], 0);
2372 /* Hack -- Complete the prompt (again) */
2374 Term_addstr(-1, TERM_WHITE, " ['r'»×¤¤½Ð, ESC]");
2376 Term_addstr(-1, TERM_WHITE, " [(r)ecall, ESC]");
2391 /* Normal commands */
2392 if (query != 'r') break;
2399 if (query == ESCAPE) break;
2401 /* Move to "prev" monster */
2407 if (!expand_list) break;
2411 /* Move to "next" monster */
2417 if (!expand_list) break;
2422 /* Free the "who" array */
2423 C_KILL(who, max_r_idx, u16b);
2425 /* Re-display the identity */
2434 bool research_mon(void)
2442 bool recall = FALSE;
2448 /* XTRA HACK WHATSEARCH */
2454 /* XTRA HACK REMEMBER_IDX */
2455 static int old_sym = '\0';
2456 static int old_i = 0;
2459 /* Save the screen */
2462 /* Get a character, or abort */
2464 if (!get_com("¥â¥ó¥¹¥¿¡¼¤Îʸ»ú¤òÆþÎϤ·¤Æ²¼¤µ¤¤(µ¹æ or ^AÁ´,^U¥æ,^NÈó¥æ,^M̾Á°):", &sym, FALSE))
2466 if (!get_com("Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): ", &sym, FALSE))
2476 /* Find that character info, and describe it */
2477 for (i = 0; ident_info[i]; ++i)
2479 if (sym == ident_info[i][0]) break;
2482 /* XTRA HACK WHATSEARCH */
2483 if (sym == KTRL('A'))
2487 strcpy(buf, "Á´¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
2489 strcpy(buf, "Full monster list.");
2492 else if (sym == KTRL('U'))
2496 strcpy(buf, "¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
2498 strcpy(buf, "Unique monster list.");
2501 else if (sym == KTRL('N'))
2505 strcpy(buf, "¥æ¥Ë¡¼¥¯³°¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
2507 strcpy(buf, "Non-unique monster list.");
2510 else if (sym == KTRL('M'))
2514 if (!get_string("̾Á°(±Ñ¸ì¤Î¾ì¹ç¾®Ê¸»ú¤Ç²Ä)",temp, 70))
2516 if (!get_string("Enter name:",temp, 70))
2527 sprintf(buf, "̾Á°:%s¤Ë¥Þ¥Ã¥Á",temp);
2529 sprintf(buf, "Monsters with a name \"%s\"",temp);
2532 else if (ident_info[i])
2534 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
2539 sprintf(buf, "%c - %s", sym, "̵¸ú¤Êʸ»ú");
2541 sprintf(buf, "%c - %s.", sym, "Unknown Symbol");
2546 /* Display the result */
2550 /* Allocate the "who" array */
2551 C_MAKE(who, max_r_idx, u16b);
2553 /* Collect matching monsters */
2554 for (n = 0, i = 1; i < max_r_idx; i++)
2556 monster_race *r_ptr = &r_info[i];
2558 /* XTRA HACK WHATSEARCH */
2559 /* Require non-unique monsters if needed */
2560 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
2562 /* Require unique monsters if needed */
2563 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
2570 for (xx=0; temp[xx] && xx<80; xx++){
2572 if (iskanji( temp[xx])) { xx++; continue; }
2574 if (isupper(temp[xx])) temp[xx]=tolower(temp[xx]);
2578 strcpy(temp2, r_name+r_ptr->E_name);
2580 strcpy(temp2, r_name+r_ptr->name);
2582 for (xx=0; temp2[xx] && xx<80; xx++)
2583 if (isupper(temp2[xx])) temp2[xx]=tolower(temp2[xx]);
2586 if (strstr(temp2, temp) || strstr_j(r_name + r_ptr->name, temp) )
2588 if (strstr(temp2, temp))
2592 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
2595 /* Nothing to recall */
2598 /* Free the "who" array */
2599 C_KILL(who, max_r_idx, u16b);
2611 /* Sort if needed */
2614 /* Select the sort method */
2615 ang_sort_comp = ang_sort_comp_hook;
2616 ang_sort_swap = ang_sort_swap_hook;
2618 /* Sort the array */
2619 ang_sort(who, &why, n);
2623 /* Start at the end */
2624 /* XTRA HACK REMEMBER_IDX */
2625 if (old_sym == sym && old_i < n) i = old_i;
2630 /* Scan the monster memory */
2633 /* Extract a race */
2636 /* Save this monster ID */
2637 p_ptr->monster_race_idx = r_idx;
2639 /* Hack -- Handle stuff */
2642 /* Hack -- Begin the prompt */
2645 /* Hack -- Complete the prompt */
2647 Term_addstr(-1, TERM_WHITE, " ['r'»×¤¤½Ð, ' '¤Ç³¹Ô, ESC]");
2649 Term_addstr(-1, TERM_WHITE, " [(r)ecall, ESC, space to continue]");
2659 /* Recall on screen */
2660 monster_race *r_ptr = &r_info[r_idx];
2663 /* Hack -- Maximal info */
2664 r_ptr->r_wake = r_ptr->r_ignore = MAX_UCHAR;
2666 /* Observe "maximal" attacks */
2667 for (m = 0; m < 4; m++)
2669 /* Examine "actual" blows */
2670 if (r_ptr->blow[m].effect || r_ptr->blow[m].method)
2672 /* Hack -- maximal observations */
2673 r_ptr->r_blows[m] = MAX_UCHAR;
2677 /* Hack -- maximal drops */
2678 r_ptr->r_drop_gold = r_ptr->r_drop_item =
2679 (((r_ptr->flags1 & RF1_DROP_4D2) ? 8 : 0) +
2680 ((r_ptr->flags1 & RF1_DROP_3D2) ? 6 : 0) +
2681 ((r_ptr->flags1 & RF1_DROP_2D2) ? 4 : 0) +
2682 ((r_ptr->flags1 & RF1_DROP_1D2) ? 2 : 0) +
2683 ((r_ptr->flags1 & RF1_DROP_90) ? 1 : 0) +
2684 ((r_ptr->flags1 & RF1_DROP_60) ? 1 : 0));
2686 /* Hack -- but only "valid" drops */
2687 if (r_ptr->flags1 & RF1_ONLY_GOLD) r_ptr->r_drop_item = 0;
2688 if (r_ptr->flags1 & RF1_ONLY_ITEM) r_ptr->r_drop_gold = 0;
2690 /* Hack -- observe many spells */
2691 r_ptr->r_cast_inate = MAX_UCHAR;
2692 r_ptr->r_cast_spell = MAX_UCHAR;
2694 /* Hack -- know all the flags */
2695 r_ptr->r_flags1 = r_ptr->flags1;
2696 r_ptr->r_flags2 = r_ptr->flags2;
2697 r_ptr->r_flags3 = r_ptr->flags3;
2698 r_ptr->r_flags4 = r_ptr->flags4;
2699 r_ptr->r_flags5 = r_ptr->flags5;
2700 r_ptr->r_flags6 = r_ptr->flags6;
2702 r_ptr->r_xtra1 |= MR1_SINKA;
2704 /* know every thing mode */
2705 screen_roff(r_idx, 0x01);
2708 /* XTRA HACK REMEMBER_IDX */
2716 /* Normal commands */
2717 if (query != 'r') break;
2724 if (query == ESCAPE) break;
2726 /* Move to "prev" monster */
2732 if (!expand_list) break;
2736 /* Move to "next" monster */
2742 if (!expand_list) break;
2748 /* Re-display the identity */
2749 /* prt(buf, 5, 5);*/
2751 /* Free the "who" array */
2752 C_KILL(who, max_r_idx, u16b);
2757 return (!notpicked);