* The "known" should be TRUE for cast/pray, FALSE for study
*/
-bool select_the_force=FALSE;
+bool select_the_force = FALSE;
static int get_spell(int *sn, cptr prompt, int sval, bool learned, int use_realm)
{
}
+static bool player_has_no_spellbooks(void)
+{
+ int i;
+ object_type *o_ptr;
+
+ for (i = 0; i < INVEN_PACK; i++)
+ {
+ o_ptr = &inventory[i];
+ if (o_ptr->k_idx && check_book_realm(o_ptr->tval, o_ptr->sval)) return FALSE;
+ }
+
+ for (i = cave[py][px].o_idx; i; i = o_ptr->next_o_idx)
+ {
+ o_ptr = &o_list[i];
+ if (o_ptr->k_idx && check_book_realm(o_ptr->tval, o_ptr->sval)) return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+static void confirm_use_force(bool browse_only)
+{
+ int item;
+ char which;
+
+#ifdef ALLOW_REPEAT
+
+ /* Get the item index */
+ if (repeat_pull(&item) && (item == INVEN_FORCE))
+ {
+ browse_only ? do_cmd_mind_browse() : do_cmd_mind();
+ return;
+ }
+
+#endif /* ALLOW_REPEAT */
+
+ /* Show the prompt */
+#ifdef JP
+ prt("('w'Îýµ¤½Ñ, ESC) 'w'¤«ESC¤ò²¡¤·¤Æ¤¯¤À¤µ¤¤¡£ ", 0, 0);
+#else
+ prt("(w for the Force, ESC) Hit 'w' or ESC. ", 0, 0);
+#endif
+
+ while (1)
+ {
+ /* Get a key */
+ which = inkey();
+
+ if (which == ESCAPE) break;
+ else if (which == 'w')
+ {
+
+#ifdef ALLOW_REPEAT
+
+ repeat_push(INVEN_FORCE);
+
+#endif /* ALLOW_REPEAT */
+
+ break;
+ }
+ }
+
+ /* Clear the prompt line */
+ prt("", 0, 0);
+
+ if (which == 'w')
+ {
+ browse_only ? do_cmd_mind_browse() : do_cmd_mind();
+ }
+}
+
+
/*
* Peruse the spells/prayers in a book
*
if (!(p_ptr->realm1 || p_ptr->realm2) && (p_ptr->pclass != CLASS_SORCERER) && (p_ptr->pclass != CLASS_RED_MAGE))
{
#ifdef JP
-msg_print("ËܤòÆɤळ¤È¤¬¤Ç¤¤Ê¤¤¡ª");
+ msg_print("ËܤòÆɤळ¤È¤¬¤Ç¤¤Ê¤¤¡ª");
#else
msg_print("You cannot read books!");
#endif
set_action(ACTION_NONE);
}
+ if (p_ptr->pclass == CLASS_FORCETRAINER)
+ {
+ if (player_has_no_spellbooks())
+ {
+ confirm_use_force(TRUE);
+ return;
+ }
+ select_the_force = TRUE;
+ }
+
/* Restrict choices to "useful" books */
if (p_ptr->realm2 == REALM_NONE) item_tester_tval = mp_ptr->spell_book;
else item_tester_hook = item_tester_learn_spell;
/* Get an item */
#ifdef JP
-q = "¤É¤ÎËܤòÆɤߤޤ¹¤«? ";
+ q = "¤É¤ÎËܤòÆɤߤޤ¹¤«? ";
#else
q = "Browse which book? ";
#endif
#ifdef JP
-s = "Æɤá¤ëËܤ¬¤Ê¤¤¡£";
+ s = "Æɤá¤ëËܤ¬¤Ê¤¤¡£";
#else
s = "You have no books that you can read.";
#endif
- if (p_ptr->pclass == CLASS_FORCETRAINER)
- select_the_force = TRUE;
- if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))){
- select_the_force = FALSE;
- return;
+ if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR)))
+ {
+ select_the_force = FALSE;
+ return;
}
select_the_force = FALSE;
- if (item == INVEN_FORCE) { /* the_force */
- do_cmd_mind_browse();
- return;
- } else
+ if (item == INVEN_FORCE) /* the_force */
+ {
+ do_cmd_mind_browse();
+ return;
+ }
+
/* Get the item (in the pack) */
- if (item >= 0)
+ else if (item >= 0)
{
o_ptr = &inventory[item];
}
if (!p_ptr->realm1 && (p_ptr->pclass != CLASS_SORCERER) && (p_ptr->pclass != CLASS_RED_MAGE))
{
#ifdef JP
-msg_print("¼öʸ¤ò¾§¤¨¤é¤ì¤Ê¤¤¡ª");
+ msg_print("¼öʸ¤ò¾§¤¨¤é¤ì¤Ê¤¤¡ª");
#else
msg_print("You cannot cast spells!");
#endif
/* Require lite */
if (p_ptr->blind || no_lite())
{
+ if (p_ptr->pclass == CLASS_FORCETRAINER) confirm_use_force(FALSE);
+ else
+ {
#ifdef JP
-msg_print("Ìܤ¬¸«¤¨¤Ê¤¤¡ª");
+ msg_print("Ìܤ¬¸«¤¨¤Ê¤¤¡ª");
#else
- msg_print("You cannot see!");
+ msg_print("You cannot see!");
#endif
- if (p_ptr->pclass == CLASS_FORCETRAINER)
- do_cmd_mind();
- else
flush();
+ }
return;
}
if (p_ptr->confused)
{
#ifdef JP
-msg_print("º®Í𤷤Ƥ¤¤Æ¾§¤¨¤é¤ì¤Ê¤¤¡ª");
+ msg_print("º®Í𤷤Ƥ¤¤Æ¾§¤¨¤é¤ì¤Ê¤¤¡ª");
#else
msg_print("You are too confused!");
#endif
return;
}
+ if (p_ptr->pclass == CLASS_FORCETRAINER)
+ {
+ if (player_has_no_spellbooks())
+ {
+ confirm_use_force(FALSE);
+ return;
+ }
+ select_the_force = TRUE;
+ }
+
prayer = spell_category_name(mp_ptr->spell_book);
/* Restrict choices to spell books */
/* Get an item */
#ifdef JP
-q = "¤É¤Î¼öʸ½ñ¤ò»È¤¤¤Þ¤¹¤«? ";
+ q = "¤É¤Î¼öʸ½ñ¤ò»È¤¤¤Þ¤¹¤«? ";
#else
q = "Use which book? ";
#endif
#ifdef JP
-s = "¼öʸ½ñ¤¬¤Ê¤¤¡ª";
+ s = "¼öʸ½ñ¤¬¤Ê¤¤¡ª";
#else
s = "You have no spell books!";
#endif
- if (p_ptr->pclass == CLASS_FORCETRAINER)
- select_the_force = TRUE;
- if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))){
- select_the_force = FALSE;
- return;
+ if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR)))
+ {
+ select_the_force = FALSE;
+ return;
}
select_the_force = FALSE;
- if (item == INVEN_FORCE) { /* the_force */
- do_cmd_mind();
- return;
- } else
+ if (item == INVEN_FORCE) /* the_force */
+ {
+ do_cmd_mind();
+ return;
+ }
+
/* Get the item (in the pack) */
- if (item >= 0)
+ else if (item >= 0)
{
o_ptr = &inventory[item];
}
{
/* Begin the prompt */
#ifdef JP
-sprintf(out_val, "»ý¤Áʪ:");
+ sprintf(out_val, "»ý¤Áʪ:");
#else
sprintf(out_val, "Inven:");
#endif
-
/* Some legal items */
if ((i1 <= i2) && !use_menu)
{
/* Build the prompt */
#ifdef JP
-sprintf(tmp_val, "%c-%c,'(',')',",
+ sprintf(tmp_val, "%c-%c,'(',')',",
#else
sprintf(tmp_val, " %c-%c,'(',')',",
#endif
-
index_to_label(i1), index_to_label(i2));
/* Append */
/* Indicate ability to "view" */
#ifdef JP
-if (!command_see && !use_menu) strcat(out_val, " '*'°ìÍ÷,");
+ if (!command_see && !use_menu) strcat(out_val, " '*'°ìÍ÷,");
#else
if (!command_see && !use_menu) strcat(out_val, " * to see,");
#endif
-
/* Append */
#ifdef JP
-if (equip) strcat(out_val, format(" %s ÁõÈ÷ÉÊ,", use_menu ? "'4'or'6'" : "'/'"));
-else if (select_the_force)
- strcat(out_val, " 'w'Îýµ¤½Ñ,");
+ if (equip) strcat(out_val, format(" %s ÁõÈ÷ÉÊ,", use_menu ? "'4'or'6'" : "'/'"));
#else
-if (equip) strcat(out_val, format(" %s for Equip,", use_menu ? "4 or 6" : "/"));
-else if (select_the_force)
- strcat(out_val, " w for the Force,");
+ if (equip) strcat(out_val, format(" %s for Equip,", use_menu ? "4 or 6" : "/"));
#endif
-
}
/* Viewing equipment */
{
/* Begin the prompt */
#ifdef JP
-sprintf(out_val, "ÁõÈ÷ÉÊ:");
+ sprintf(out_val, "ÁõÈ÷ÉÊ:");
#else
sprintf(out_val, "Equip:");
#endif
-
/* Some legal items */
if ((e1 <= e2) && !use_menu)
{
/* Build the prompt */
#ifdef JP
-sprintf(tmp_val, "%c-%c,'(',')',",
+ sprintf(tmp_val, "%c-%c,'(',')',",
#else
sprintf(tmp_val, " %c-%c,'(',')',",
#endif
-
index_to_label(e1), index_to_label(e2));
/* Append */
/* Indicate ability to "view" */
#ifdef JP
-if (!command_see && !use_menu) strcat(out_val, " '*'°ìÍ÷,");
+ if (!command_see && !use_menu) strcat(out_val, " '*'°ìÍ÷,");
#else
if (!command_see) strcat(out_val, " * to see,");
#endif
-
/* Append */
#ifdef JP
-if (inven) strcat(out_val, format(" %s »ý¤Áʪ,", use_menu ? "'4'or'6'" : "'/'"));
+ if (inven) strcat(out_val, format(" %s »ý¤Áʪ,", use_menu ? "'4'or'6'" : "'/'"));
#else
-if (inven) strcat(out_val, format(" %s for Inven,", use_menu ? "4 or 6" : "'/'"));
+ if (inven) strcat(out_val, format(" %s for Inven,", use_menu ? "4 or 6" : "'/'"));
#endif
-
}
/* Indicate legality of the "floor" item */
#ifdef JP
-if (allow_floor) strcat(out_val, " '-'¾²¾å,");
+ if (allow_floor) strcat(out_val, " '-'¾²¾å,");
+ if (select_the_force) strcat(out_val, " 'w'Îýµ¤½Ñ,");
#else
if (allow_floor) strcat(out_val, " - for floor,");
+ if (select_the_force) strcat(out_val, " w for the Force,");
#endif
-
/* Finish the prompt */
strcat(out_val, " ESC");
/* Show the prompt */
prt(tmp_val, 0, 0);
-
/* Get a key */
which = inkey();
{
/* Begin the prompt */
#ifdef JP
-sprintf(out_val, "»ý¤Áʪ:");
+ sprintf(out_val, "»ý¤Áʪ:");
#else
sprintf(out_val, "Inven:");
#endif
{
/* Build the prompt */
#ifdef JP
-sprintf(tmp_val, "%c-%c,'(',')',",
+ sprintf(tmp_val, "%c-%c,'(',')',",
#else
sprintf(tmp_val, " %c-%c,'(',')',",
#endif
-
index_to_label(i1), index_to_label(i2));
/* Append */
/* Indicate ability to "view" */
#ifdef JP
-if (!command_see && !use_menu) strcat(out_val, " '*'°ìÍ÷,");
+ if (!command_see && !use_menu) strcat(out_val, " '*'°ìÍ÷,");
#else
if (!command_see && !use_menu) strcat(out_val, " * to see,");
#endif
-
/* Append */
-#ifdef JP
if (allow_equip)
{
+#ifdef JP
if (!use_menu)
strcat(out_val, " '/' ÁõÈ÷ÉÊ,");
else if (allow_floor)
strcat(out_val, " '6' ÁõÈ÷ÉÊ,");
else
strcat(out_val, " '4'or'6' ÁõÈ÷ÉÊ,");
- }
- else if (select_the_force)
- strcat(out_val, " 'w'Îýµ¤½Ñ,");
#else
- if (allow_equip)
- {
if (!use_menu)
strcat(out_val, " / for Equip,");
else if (allow_floor)
strcat(out_val, " 6 for Equip,");
else
strcat(out_val, " 4 or 6 for Equip,");
- }
- else if (select_the_force)
- strcat(out_val, " w for the Force,");
#endif
+ }
/* Append */
if (allow_floor)
strcat(out_val, " 4 or 6 for floor,");
#endif
}
-
}
/* Viewing equipment */
{
/* Begin the prompt */
#ifdef JP
-sprintf(out_val, "ÁõÈ÷ÉÊ:");
+ sprintf(out_val, "ÁõÈ÷ÉÊ:");
#else
sprintf(out_val, "Equip:");
#endif
-
if (!use_menu)
{
/* Build the prompt */
#ifdef JP
-sprintf(tmp_val, "%c-%c,'(',')',",
+ sprintf(tmp_val, "%c-%c,'(',')',",
#else
sprintf(tmp_val, " %c-%c,'(',')',",
#endif
-
index_to_label(e1), index_to_label(e2));
/* Append */
/* Indicate ability to "view" */
#ifdef JP
-if (!command_see && !use_menu) strcat(out_val, " '*'°ìÍ÷,");
+ if (!command_see && !use_menu) strcat(out_val, " '*'°ìÍ÷,");
#else
if (!command_see && !use_menu) strcat(out_val, " * to see,");
#endif
-
/* Append */
if (allow_inven)
{
else
strcat(out_val, " '4'or'6' »ý¤Áʪ,");
#else
-
if (!use_menu)
strcat(out_val, " / for Inven,");
else if (allow_floor)
sprintf(out_val, "Floor:");
#endif
-
if (!use_menu)
{
/* Build the prompt */
#ifdef JP
-sprintf(tmp_val, "%c-%c,'(',')',", n1, n2);
+ sprintf(tmp_val, "%c-%c,'(',')',", n1, n2);
#else
sprintf(tmp_val, " %c-%c,'(',')',", n1, n2);
#endif
-
/* Append */
strcat(out_val, tmp_val);
}
/* Indicate ability to "view" */
#ifdef JP
-if (!command_see && !use_menu) strcat(out_val, " '*'°ìÍ÷,");
+ if (!command_see && !use_menu) strcat(out_val, " '*'°ìÍ÷,");
#else
if (!command_see && !use_menu) strcat(out_val, " * to see,");
#endif
-
if (use_menu)
{
if (allow_inven && allow_equip)
#else
strcat(out_val, " 4 for Equip, 6 for Inven,");
#endif
-
}
else if (allow_inven)
{
#else
strcat(out_val, " 4 or 6 for Inven,");
#endif
-
}
else if (allow_equip)
{
#else
strcat(out_val, " 4 or 6 for Equip,");
#endif
-
}
}
/* Append */
#else
strcat(out_val, " / for Inven,");
#endif
-
}
else if (allow_equip)
{
#else
strcat(out_val, " / for Equip,");
#endif
-
}
/* Append */
}
}
+ /* Append */
+#ifdef JP
+ if (select_the_force) strcat(out_val, " 'w'Îýµ¤½Ñ,");
+#else
+ if (select_the_force) strcat(out_val, " w for the Force,");
+#endif
+
/* Finish the prompt */
strcat(out_val, " ESC");